If you look at the User object, the second parameter in the constructor will be the password.
UserDetailsService is used to load the user from a basic structure, such as a database. The loadUserByUsername method is called when a user tries to log in with a username and password, namely, the service service loads the user and returns him to the security framework. The required data includes data such as username , password , accountNonExpired , credentialsNonExpired , accountNonLocked and authorities .
As soon as spring protection receives the user object, it will check the user for the password entered by the user and other data, such as the status of the user account (accountNonExpired, credentialsNonExpired, etc.).
Arun P Johny
source share