public class ArchiveUserDetailsManager extends Object implements InitializingBean, UserDetailsManager
Manager for archive users. This class acts as a UserDetailsService
that can be used as part of the authentication system and allows modifying
the user information in the database through the UserDetailsManager
interface.
When used with authentication methods that result in the
loadUserByUsername(String)
method being called frequently (e.g. each
request), it is recommended to add a UserCache
to the
AuthenticationProvider
in order to reduce latency.
Internally, this service uses the GenericDataStoreDAO
for storing
user information.
Modifier and Type | Field and Description |
---|---|
static String |
ROLE_ADMIN
String identifying the role associated with administrative privileges.
|
Constructor and Description |
---|
ArchiveUserDetailsManager() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
changePassword(String oldPlainTextPassword,
String newPlainTextPassword) |
void |
createUser(UserDetails user) |
void |
deleteUser(String username) |
UserDetails |
loadUserByUsername(String username) |
void |
setGenericDataStoreDAO(GenericDataStoreDAO genericDataStoreDAO)
Sets the DAO for reading and writing generic pieces of configuration
data.
|
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Sets the object mapper used for converting between the JSON and the Java
representation of user objects.
|
void |
setPasswordEncoder(BCryptPasswordEncoder passwordEncoder)
Sets the password encoded used for encoding and checking password.
|
void |
updateUser(UserDetails user) |
boolean |
userExists(String username) |
public static final String ROLE_ADMIN
ROLE_ADMIN_AUTHORITY
,
Constant Field Valuespublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void changePassword(String oldPlainTextPassword, String newPlainTextPassword)
changePassword
in interface UserDetailsManager
public void createUser(UserDetails user)
createUser
in interface UserDetailsManager
public void deleteUser(String username)
deleteUser
in interface UserDetailsManager
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
loadUserByUsername
in interface UserDetailsService
UsernameNotFoundException
@Autowired public void setGenericDataStoreDAO(GenericDataStoreDAO genericDataStoreDAO)
genericDataStoreDAO
- generic data-store DAO to be used by this service.public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper
- object mapper used for serializing user objects to and
deserializing user objects from their JSON representation,
which is used when storing them in the database.public void setPasswordEncoder(BCryptPasswordEncoder passwordEncoder)
changePassword(String, String)
method. All other methods only deal with password hashes so that they do
not need a password encoder. If not set explicitly, a BCrypt password
encoder is created using the default constructor.passwordEncoder
- password encoder to be used for checking the old and
generating the new password hash in
changePassword(String, String)
.public void updateUser(UserDetails user)
updateUser
in interface UserDetailsManager
public boolean userExists(String username)
userExists
in interface UserDetailsManager
Copyright © 2011–2017 aquenos GmbH. All rights reserved.