UserDetailsService
UserDetailsService is a Spring Security interface for retrieving user-specific data required during authentication.
Spring Security in Action, Second Edition
UserDetailsService is a Spring Security interface for retrieving user-specific data needed to authenticate a user.
- How it is used
- Retrieves user details for AuthenticationProvider during Spring Security authentication.
- How deep it goes
- Defines the single retrieval method, custom implementations, provided implementations, registration, and testing, while deferring password encoding details.
- Examples
- Uses in-memory users, a custom list-backed service, curl requests, and @WithUserDetails integration tests.
- What you can do after
- Builds or configures a user-details provider and tests authentication against an endpoint.
Read how Spring Security in Action, Second Edition explains UserDetailsService →
Spring in Action, Sixth Edition
UserDetailsService is a Spring Security interface that retrieves user-specific authentication details synchronously.
- How it is used
- Configures authentication by supplying Spring Security with user-specific details through a UserDetailsService bean.
- How deep it goes
- Defines the one-method contract and demonstrates in-memory and repository-backed implementations with missing-user handling.
- Examples
- Uses in-memory users named buzz and woody, then demonstrates a Taco Cloud database lookup through UserRepository.
- What you can do after
- Build it from scratch by declaring an in-memory or repository-backed UserDetailsService bean.
Read how Spring in Action, Sixth Edition explains UserDetailsService →
Related concepts
- ReactiveUserDetailsServiceequivalent to · ReactiveUserDetailsService is a Spring Security interface for asynchronously retrieving user details used in authentication.
- AuthenticationProviderused by · AuthenticationProvider is a Spring Security interface or component that encapsulates a specific authentication mechanism and returns an authentication result.
- InMemoryUserDetailsManagerimplemented by · InMemoryUserDetailsManager is a Spring Security UserDetailsService and UserDetailsManager implementation that stores user details in application memory.
- UserDetailsManagerincludes · UserDetailsManager is a Spring Security interface that extends UserDetailsService with operations for creating users and modifying or deleting user passwords.
- functional interfacekind of · A functional interface is an interface with exactly one abstract operation, making it compatible with implementation by a function, lambda expression, or method reference.
- loadUserByUsernamehas part · loadUserByUsername is the UserDetailsService operation that retrieves the security information associated with a specified username.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

