Spring security “forward:” directive can't forward to login form

前端 未结 3 1597
梦谈多话
梦谈多话 2020-12-09 00:35

After a user creates their account, I want to log that user on automatically.

I have standard form logins being handled by Springs filter on /postlogin.

3条回答
  •  借酒劲吻你
    2020-12-09 00:50

    The new filtering feature in Servlet 2.4 basically alleviates the restriction that filters can only operate in the request flow before and after the actual request processing by the application server. Instead, Servlet 2.4 filters can now interact with the request dispatcher at every dispatch point. This means that when a Web resource forwards a request to another resource (for instance, a servlet forwarding the request to a JSP page in the same application), a filter can be operating before the request is handled by the targeted resource. It also means that should a Web resource include the output or function from other Web resources (for instance, a JSP page including the output from multiple other JSP pages), Servlet 2.4 filters can work before and after each of the included resources. .

    To turn on that feature you need:

    web.xml

       
        springSecurityFilterChain   
        org.springframework.web.filter.DelegatingFilterProxy 
      
       
        springSecurityFilterChain   
        /*
        REQUEST
        FORWARD
    
    

    RegistrationController

    return "forward:/login?j_username=" + registrationModel.getUserEmail()
        + "&j_password=" + registrationModel.getPassword();
    

提交回复
热议问题