如何获取authlogic使用Rails会话而不是自己的cookie? [英] How can I get authlogic to use the Rails session instead of its own cookie?

查看:299
本文介绍了如何获取authlogic使用Rails会话而不是自己的cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让authogic永远不要设置 user_credentials cookie,并且只使用标准的Rails会话cookie。

I would like authogic to never set a user_credentials cookie, and only use the standard Rails session cookie.

我看到之后包含在 Authlogic :: Session :: Session :: Base Cookie 。如果我登录我的应用程序,然后删除 user_credentials cookie,我仍然保持登录。所以显然authlogic存储凭据在两个地方,并检查两个地方?或者忽略cookie但仍然设置它?我如何让它从不设置或引用 user_credentials cookie?

I see Session is included in Authlogic::Session::Session::Base after Cookies. If I log into my app and then delete the user_credentials cookie, I still stay logged in. So apparently authlogic is storing the credentials in both places and checking both places? Or ignoring the cookie but still setting it? How can I have it never set or reference the user_credentials cookie?

推荐答案

根据我在这里的问题的答案...

According to the answer to my question here…

如何清除供应商代码插入的回调?

...这个问题的答案是:在我的UserSession定义上面这样做:

…the answer to THIS question is to do this above my UserSession definition:

Authlogic::Session::Base.after_save.delete_if{ |callback| callback.method == :save_cookie }
class UserSession < Authlogic::Session::Base
end

这篇关于如何获取authlogic使用Rails会话而不是自己的cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆