Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public class JdbcUserDetailsManager
- Object
- JdbcUserDetailsManager
ImplementsUserDetailsManager, UserDetailsPasswordService, UserDetailsService
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.
Constructors
public JdbcUserDetailsManager(DataSource dataSource) |
Methods
public UserDetails loadUserByUsername(String username) | The user of that name; never null. |
public void createUser(UserDetails user) | |
public void updateUser(UserDetails user) | |
public void deleteUser(String username) | |
public boolean userExists(String username) | |
public void changePassword(String oldPassword, String newPassword) | Sets the signed-in user’s password to newPassword, which is stored as given. |
public UserDetails updatePassword(UserDetails user, String newPassword) | Stores newPassword, which is already encoded, as user’s password, and returns the user as it now is. |
Inherited methods
Constructor details
JdbcUserDetailsManager
public JdbcUserDetailsManager(DataSource dataSource)Method details
loadUserByUsername
public UserDetails loadUserByUsername(String username)The user of that name; never null.
Throws
UsernameNotFoundException- when there is none, or the user has no authority at all
createUser
public void createUser(UserDetails user)updateUser
public void updateUser(UserDetails user)deleteUser
public void deleteUser(String username)userExists
public boolean userExists(String username)changePassword
public void changePassword(String oldPassword, String newPassword)Sets the signed-in user’s password to
newPassword, which is stored as
given. oldPassword is not checked here: re-authenticate before calling.updatePassword
public UserDetails updatePassword(UserDetails user, String newPassword)Stores
newPassword, which is already encoded, as user’s password, and
returns the user as it now is.