记住我-春季安全
我目前正在尝试在我的网站中实现“记住我”功能。以下是我的配置的一部分
<security:remember-me services-ref="rememberMeServices" />
<bean id="rememberMeServices" class="com.entertainment.ecom.web.auth.EcomRemembe rMeServices">
<property name="userDetailsService" ref="ecomUserDetailsService"/>
<property name="key" value="a23eef6dfd1514cb885f47070380ff18"/>
<property name="cookieName" value="ENTC"/>
<property name="tokenValiditySeconds" value="80000"/>
</bean>
My EcomRememberMeServices
extends AbstractRememberMeServices
&我已经重写了 onLoginFail
& onLoginSuccess
方法。我的问题是,从哪里调用我的 onLoginSuccess()
方法?
我尝试运行上面的配置&可以看到 onLoginFail
通过 RememberMeAuthenticationFilter(rememberMeServices.loginFail(request, response))
被调用,但是当我检查此过滤器的源代码时,我找不到任何调用onLoginSuccess()
或 loginSuccess()
方法。那么我需要明确地调用它吗?
在BasicAuthenticationFilter
中,调用了该方法。所以我尝试使用它,但仍然不起作用。(
)。那么有人可以帮我吗?
I am currently trying to implement remember me functionality in my website. Following is part of my configuration
<security:remember-me services-ref="rememberMeServices" />
<bean id="rememberMeServices" class="com.entertainment.ecom.web.auth.EcomRemembe rMeServices">
<property name="userDetailsService" ref="ecomUserDetailsService"/>
<property name="key" value="a23eef6dfd1514cb885f47070380ff18"/>
<property name="cookieName" value="ENTC"/>
<property name="tokenValiditySeconds" value="80000"/>
</bean>
My EcomRememberMeServices
extends AbstractRememberMeServices
& I have overridden onLoginFail
& onLoginSuccess
methods. My question is, from where my onLoginSuccess()
method will be called?
I have tried to run above configuration & it was seen that onLoginFail
gets called through RememberMeAuthenticationFilter(rememberMeServices.loginFail(request, response))
but when I checked source code for this filter, I could not find any call for onLoginSuccess()
or loginSuccess()
method. So do I need to call this explicitly?
In BasicAuthenticationFilter
, there is a call for this method. So I tried to use it but still i does not work.(<http-basic/>
). So can anyone please help me in this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还有一种方法 logout(),由注销过滤器调用。我想您还必须将
rememberMeServices
注入登录和注销过滤器(我不确定是否可以在 xml 中的 http 元素中完成):
There is one more method logout(), which is called by logout filter. I guess you have to inject
rememberMeServices
into Login and Logout Filter as well (I am not sure if it can be done within http element in xml):and