Make spring security add the return to url in the query string for the login page

前端 未结 3 639
别跟我提以往
别跟我提以往 2020-12-10 09:27

Earlier I asked if it was possible to get the original request url in the form login page in Spring Security 2. Turns out that actually won\'t help me, what I need is for th

3条回答
  •  被撕碎了的回忆
    2020-12-10 09:47

    I guess you need to use spring-security-redirect. Essentially, if your url is of the form /login.html?spring-security-redirect=/secure.html, spring security will automagically redirect to secure.html on successful login.

    As of spring 3.1.x this no longer works out-of-the-box. You'll need to add:

    authentication-success-handler-ref="simpleUrlAuthenticationSuccessHandler"
    

    ...to your element and add a bean that looks like:

    
    
        
        
        
    
    

提交回复
热议问题