public class InMemoryUserDetailsManager extends Object implements UserDetailsManager
UserDetailsManager
which is backed by an in-memory map.
Mainly intended for testing and demonstration purposes, where a full blown persistent system isn't required.
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
InMemoryUserDetailsManager(Collection<UserDetails> users) |
InMemoryUserDetailsManager(Properties users) |
Modifier and Type | Method and Description |
---|---|
void |
changePassword(String oldPassword,
String newPassword)
Modify the current user's password.
|
void |
createUser(UserDetails user)
Create a new user with the supplied details.
|
void |
deleteUser(String username)
Remove the user with the given login name from the system.
|
UserDetails |
loadUserByUsername(String username)
Locates the user based on the username.
|
void |
setAuthenticationManager(AuthenticationManager authenticationManager) |
void |
updateUser(UserDetails user)
Update the specified user.
|
boolean |
userExists(String username)
Check if a user with the supplied login name exists in the system.
|
public InMemoryUserDetailsManager(Collection<UserDetails> users)
public InMemoryUserDetailsManager(Properties users)
public void createUser(UserDetails user)
UserDetailsManager
createUser
in interface UserDetailsManager
public void deleteUser(String username)
UserDetailsManager
deleteUser
in interface UserDetailsManager
public void updateUser(UserDetails user)
UserDetailsManager
updateUser
in interface UserDetailsManager
public boolean userExists(String username)
UserDetailsManager
userExists
in interface UserDetailsManager
public void changePassword(String oldPassword, String newPassword)
UserDetailsManager
changePassword
in interface UserDetailsManager
oldPassword
- current password (for re-authentication if required)newPassword
- the password to change topublic UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
UserDetailsService
UserDetails
object that comes back may have a username that is of a different case than what was
actually requested..loadUserByUsername
in interface UserDetailsService
username
- the username identifying the user whose data is required.null
)UsernameNotFoundException
- if the user could not be found or the user has no GrantedAuthoritypublic void setAuthenticationManager(AuthenticationManager authenticationManager)