[英]Custom locale redirect after login - Spring Security
I am writing a simple prototype Spring MVC 3.2 with Spring Security. 我正在用Spring Security写一个简单的原型Spring MVC 3.2。 My requirements specify that the urls must be of the following structure
我的要求指定网址必须具有以下结构
http://app-name/{locale}/signin
http://app-name/{locale}/logout
http://app-name/{locale}/account
I have implemented a Filter to set the locale as a request attribute and successfully managed to get everything working, except spring-security login process, where it does redirect to /account on successful login. 我已经实现了一个过滤器,将语言环境设置为请求属性,并成功地使一切正常运行,但spring-security登录过程除外,该过程在成功登录时会重定向到/ account。
I was wondering whether it is possible to define some kind of wrappers for these actions? 我想知道是否可以为这些动作定义某种包装器?
<security:intercept-url pattern="/signin" access="permitAll"/>
<security:form-login login-page="/signin"
login-processing-url="/security_check"
username-parameter="username"
password-parameter="password"
authentication-failure-url="/signin"
default-target-url="/account"
/>
I managed to solve this by writing my own AuthenticationSuccessHandler and LogoutSuccessHandler . 我设法通过编写自己的AuthenticationSuccessHandler和LogoutSuccessHandler来解决此问题 。 See the answer below for more details
有关更多详细信息,请参见下面的答案
how to get redirected to a method at login/logout before target-url called in spring-security, spring mvc 如何在Spring-Security,Spring MVC中调用目标URL之前在登录/注销时重定向到方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.