Redirect to specific page after login
In Java EE security, if a user tries to access a secured resource, they are redirected to the login page. After successful login they are redirected to previously requested secure resource.
Is it possible to redirect the user to a specific page, in my case application entry page?
Something equivalent to Spring Security's default-target-url
and always-use-default-targ开发者_StackOverflow社区et
I ended up creating a Filter
just as the Spring Security authentication filters are created. The following Spring Security classes show how they did it.
http://grepcode.com/file/repo1.maven.org/maven2/org.springframework.security/spring-security-web/3.0.0.RELEASE/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilter.java
http://grepcode.com/file/repo1.maven.org/maven2/org.springframework.security/spring-security-web/3.0.0.RELEASE/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java#AbstractAuthenticationTargetUrlRequestHandler
http://grepcode.com/file/repo1.maven.org/maven2/org.springframework.security/spring-security-web/3.0.0.RELEASE/org/springframework/security/web/DefaultRedirectStrategy.java#DefaultRedirectStrategy
精彩评论