intermediateSpring Security

What is UserDetailsService? How does Spring Security authenticate a user?

UsernamePasswordAuthenticationFilter extracts credentials, builds a token, and passes it to AuthenticationManager, which delegates to DaoAuthenticationProvider — that calls UserDetailsService.loadUserByUsername(), compares the password via PasswordEncoder.matches(), and on success sets the resulting Authentication into SecurityContext.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What is UserDetailsService? How does Spring Security authenticate a user?

Next Step

Continue to What is PasswordEncoder? Why must you never store plain-text passwords?← Back to all Spring Boot & Microservices questions