Class JdbcUserDetailsManager
java.lang.Object
com.codename1.backend.security.core.userdetails.JdbcUserDetailsManager
- All Implemented Interfaces:
UserDetailsManager, UserDetailsPasswordService, UserDetailsService
public class JdbcUserDetailsManager
extends Object
implements UserDetailsManager, UserDetailsPasswordService
Users kept in the server's database, in the cn1_users and
cn1_authorities tables of SecuritySchema.
@Bean
UserDetailsService users(DataSource dataSource) {
return new JdbcUserDetailsManager(dataSource);
}
A user is found whatever the case of the name it is asked for by, and keeps
the spelling it was created with; two names that differ only in the case of
A to Z are one user. A password is stored as it is given: encode it
first, as for any user store.
Every change to a user and its authorities is one transaction, and joins the caller's when there is one.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangePassword(String oldPassword, String newPassword) Sets the signed-in user's password tonewPassword, which is stored as given.voidcreateUser(UserDetails user) voiddeleteUser(String username) loadUserByUsername(String username) The user of that name; never null.updatePassword(UserDetails user, String newPassword) StoresnewPassword, which is already encoded, asuser's password, and returns the user as it now is.voidupdateUser(UserDetails user) booleanuserExists(String username)
-
Constructor Details
-
JdbcUserDetailsManager
-
-
Method Details
-
loadUserByUsername
Description copied from interface:UserDetailsServiceThe user of that name; never null.
Throws
UsernameNotFoundException: when there is none, or the user has no authority at all
- Specified by:
loadUserByUsernamein interfaceUserDetailsService
-
createUser
- Specified by:
createUserin interfaceUserDetailsManager
-
updateUser
- Specified by:
updateUserin interfaceUserDetailsManager
-
deleteUser
- Specified by:
deleteUserin interfaceUserDetailsManager
-
userExists
- Specified by:
userExistsin interfaceUserDetailsManager
-
changePassword
Sets the signed-in user's password tonewPassword, which is stored as given.oldPasswordis not checked here: re-authenticate before calling.- Specified by:
changePasswordin interfaceUserDetailsManager
-
updatePassword
Description copied from interface:UserDetailsPasswordServiceStoresnewPassword, which is already encoded, asuser's password, and returns the user as it now is.- Specified by:
updatePasswordin interfaceUserDetailsPasswordService
-