Skip to content
Advertisement

endpoint for authentication with spring security

I wanna create custom endpoint for login.

JavaScript

It works fine when password and username are correct but returns 200 and login form instead 401 for incorrect data.

JavaScript

public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private final UserDetailsService userDetailsService;

JavaScript

}

Advertisement

Answer

Try something like that:

Don’t forget to Autowire AuthenticationManager and other services!

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement