Spring Security RememberMe 成功处理程序或 url 过滤
我正在使用带有登录页面和记住我过滤器的 Spring Security。记住我过滤可以发生在应用程序的任何页面上。
但当用户从登录页面和 cookie 进行身份验证时,我希望有相同的行为:
- 我想在会话中设置一些用户信息
- 我想将用户重定向到主页(always-use-default-target =“true”) ")
我已经看到 Spring Security 自 3.1.0 起就支持 Remember-me 标签的成功处理程序 (https://jira.springsource.org/browse/SEC-1603)。
对我来说另一个解决方案是限制 Remember-me 过滤器的 URL,例如拦截 URL。我只允许在默认或主页 URL 上进行记住我过滤。
在 3.1.0 版本之前,是否有标准方法来限制“记住我”过滤器的 URL 或在 cookie 身份验证后重定向用户?
I am using Spring Security with a login page and a remember-me filter. The remember-me filtering can happen on any page of the application.
But I want the same behaviour both when the user is authenticated from login page and from the cookie:
- I want to set some user information in session
- I want to redirect the user to the home page (always-use-default-target="true")
I have seen that the success-handler for the remember-me tag is supported by Spring Security since the 3.1.0 (https://jira.springsource.org/browse/SEC-1603).
Another solution for me would be to restrict the URL for the remember-me filter, like the intercept-url. I would allow the remember-me filtering only on the default or home page URL.
Is there a standard way to restrict the URL for the remember-me filter or to redirect the user after cookie authentication before the version 3.1.0?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然 - 子类 RememberMeAuthenticationFilter 并覆盖
doFilter()
。如果请求是针对主页,则调用super.doFilter()
,否则调用chain.doFilter(
)。Sure - subclass RememberMeAuthenticationFilter and override
doFilter()
. If the request is for the home page callsuper.doFilter()
, otherwise callchain.doFilter(
).