Defining And Managing Users#
User Detail Service And Password Encoder#
User detail service
andpassword encoder
are important interfaces that help maintaining the user details and validating them. That means if someone provides some credentials, these twouser detail services
andpassword encoder
will take the responsibility of validating whether the username and password entered by user is correct or not.
-
Below are some ways for us to configure
user detail service
and basicpassword encoder
: - Configure Users With inMemoryAuthentication
- Configure Users With inMemoryUserDetailsManager
- Configure Users With JdbcUserDetailsManager
- Custom UserDetailsService Of Spring Security
Summary#
- Look at how to configure users inside memory of the application using inMemoryAuthentication and InMemoryUserDetailsManager
- Look at the important interfaces and classes present in the spring security regarding defining and managing the
UserDetails
for performing authentication.- org.springframework.security.core.userdetails.UserDetails
- org.springframework.security.core.userdetails.User
- org.springframework.security.core.userdetails.UserDetailsService
- org.springframework.security.provisioning.InMemoryUserDetailsManager
- org.springframework.security.provisioning.JdbcUserDetailsManager
- Implement custom implementation of
UserDetailsService
(See Custom UserDetailsService Of Spring Security) to perform authentication using our own tables and column present inside the application database.