Spring Security provides many AuthenticationProvider for you to use. You can provide your own customized AuthenticationProvider if the provided AuthenticationProvider doesn’t satisfy your Authentication need.
AuthenticationProvider interface is one of the most important class in Spring Security. DaoAuthenticationProvider is the most used AuthenticationProvider. It retrieves UserDetails using UserDetailsService and then compares the password with the saved password in UserDetails.
Custom AuthenticationProvider
We can create a custom AuthenticationProvider by implementing AuthenticationProvider interface and override authenticate and supports method.