Set custom login url in Spring Security UsernamePasswordAuthenticationFilter JWT authentication

前端 未结 2 1692
Happy的楠姐
Happy的楠姐 2020-12-29 14:38

I\'m following this auth0\'s tutorial to secure my application using JWT.

I\'ve ended up with the following WebSecurity configuration:

@EnableWebSecu         


        
2条回答
  •  無奈伤痛
    2020-12-29 14:53

    A little improvement could be to just create your filter with custom process url and use it without create a bean that I think you don't need anywhere else than here.

    JWTAuthenticationFilter authenticationFilter = new JWTAuthenticationFilter(authenticationManager());
    authenticationFilter.setFilterProcessesUrl("/mobile/login");
    ....
    .and()
    .addFilter(authenticationFilter)
    .addFilter(new JWTAuthenticationFilter(authenticationManager()))
    

提交回复
热议问题