ruby-on-rails – 使用http基本身份验证和restful_authenticatio
发布时间:2020-12-16 22:42:19 所属栏目:百科 来源:网络整理
导读:我有一个安装在rails应用程序中的restful_authentication插件,一个sessions_controller具有这样的destroy方法: def destroy self.current_user.forget_me if logged_in? cookies.delete :auth_token reset_session flash[:notice] = "You have been logged
我有一个安装在rails应用程序中的restful_authentication插件,一个sessions_controller具有这样的destroy方法:
def destroy self.current_user.forget_me if logged_in? cookies.delete :auth_token reset_session flash[:notice] = "You have been logged out." redirect_back_or_default('/') end 在应用程序控制器中我有: before_filter :login_required 在sessions_controller中我有: skip_before_filter :login_required 我的问题是当用户使用http基本认证进行身份验证时,他/她没有注销.会话被销毁,但用户能够导航到受限的页面,没有问题.通过插件的会话认证不会发生此问题.如何使这种方法摆脱基本的认识? 解决方法
在这种情况下,服务器端无法“注销”用户.当用户通过基本认证登录时,浏览器存储认证信息,并通过HTTP头发送认证参数.如果用户使用基本认证登录,他/她将不得不关闭他/她的浏览器窗口以注销.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |