Spring Security 3 programmatically login

前端 未结 3 2299
闹比i
闹比i 2021-02-06 19:13

I\'m creating a REST web service using spring and I need to implement login/logout functions in it. The url for the functions should be something like .../api/login and .../api/

3条回答
  •  既然无缘
    2021-02-06 19:58

    Not sure if this is what you need. Programmatically call http://localhost:8080/webappname/j_spring_security_check Pass the username password in form parameters j_username and j_password. In the security-app-context.xml replace form-login element with

    
    
    
    
    

    Implement spring's AuthenticationSuccessHandler and AuthenticationFailureHandler. The default behavior is to redirect to login form.

提交回复
热议问题