【发布时间】:2011-07-15 06:14:09
【问题描述】:
当超时注销设置为 true 并设置超时时,我在使用 authlogic 单一访问令牌访问页面时遇到问题。
user.rb:
acts_as_authentic do |c|
c.logged_in_timeout = 15.minutes
end
user_session.rb:
logout_on_timeout true
控制器:
def single_access_allowed?
["download_xml"].include?(action_name)
end
如果我尝试使用令牌访问页面/方法,它会直接重定向到我的登录页面。超时注销在开启时起作用。
如果我删除超时代码并在 user.rb 中只包含acts_as_authentic,则单一访问令牌有效。
我希望能够使用单一访问令牌,以便另一个应用程序可以从我的 ruby on rails 网站打开一个 xml 文件。
关于我可能做错了什么以及在哪里寻找解决它并使其发挥作用的任何想法?
使用 authlogic 3.0.3 和 rails 3.0.7。
【问题讨论】:
-
如果有人有任何想法,我还没有弄清楚这个?
-
在 github 上发现这是 authlogic 的一个未解决问题 -> github.com/binarylogic/authlogic/issues/64 mhaley 说:“如果您只想解决应用程序中的问题,您可以像这样修改 UserSession 模型:” class UserSession :single_access? after_persisting :enforce_timeout, :unless => :single_access? end 但是,单个访问令牌有效,但超时注销停止工作。