@Service @Transactional(readOnly=true) class PersistentUserAccountManager extends Object implements UserAccountManager
UserAccountManager using a UserAccountRepository to persist UserAccount
instances. It also manages password encryption using the configured PasswordEncoder.| Constructor and Description |
|---|
PersistentUserAccountManager(UserAccountRepository repository,
org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
Creates a new
PersistentUserAccountManager using the given UserAccountRepository and
PasswordEncoder. |
| Modifier and Type | Method and Description |
|---|---|
void |
changePassword(UserAccount userAccount,
String password)
Changes the passwort of the
UserAccount. |
boolean |
contains(UserAccountIdentifier userAccountIdentifier)
Checks if an
UserAccount exists. |
UserAccount |
create(String userName,
String password,
Role... roles)
Creates a new
UserAccount. |
void |
disable(UserAccountIdentifier userAccountIdentifier)
Disables the
UserAccount. |
void |
enable(UserAccountIdentifier userAccountIdentifier)
Enables the
UserAccount. |
Iterable<UserAccount> |
findAll()
Finds all
UserAccounts. |
Optional<UserAccount> |
findByUsername(String username)
Returns the user with the given user name.
|
Iterable<UserAccount> |
findDisabled()
Finds only disabled
UserAccounts. |
Iterable<UserAccount> |
findEnabled()
Finds only enabled
UserAccounts. |
Optional<UserAccount> |
get(UserAccountIdentifier userAccountIdentifier)
Returns an
UserAccount for a given identifier. |
UserAccount |
save(UserAccount userAccount)
Saves the
UserAccount |
@Autowired public PersistentUserAccountManager(UserAccountRepository repository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
PersistentUserAccountManager using the given UserAccountRepository and
PasswordEncoder.repository - must not be null.passwordEncoder - must not be null.public UserAccount create(String userName, String password, Role... roles)
UserAccountManagerUserAccount.create in interface UserAccountManageruserName - the unique name of the user, the name is also used as loginnamepassword - the passwordroles - zero or more rolespublic Optional<UserAccount> get(UserAccountIdentifier userAccountIdentifier)
UserAccountManagerUserAccount for a given identifier.get in interface UserAccountManager@Transactional public UserAccount save(UserAccount userAccount)
UserAccountManagerUserAccountsave in interface UserAccountManager@Transactional public void enable(UserAccountIdentifier userAccountIdentifier)
UserAccountManagerUserAccount.enable in interface UserAccountManager@Transactional public void disable(UserAccountIdentifier userAccountIdentifier)
UserAccountManagerUserAccount.disable in interface UserAccountManager@Transactional public void changePassword(UserAccount userAccount, String password)
UserAccountManagerUserAccount.changePassword in interface UserAccountManagerpublic boolean contains(UserAccountIdentifier userAccountIdentifier)
UserAccountManagerUserAccount exists.contains in interface UserAccountManagerpublic Iterable<UserAccount> findAll()
UserAccountManagerUserAccounts.findAll in interface UserAccountManagerpublic Iterable<UserAccount> findEnabled()
UserAccountManagerUserAccounts.findEnabled in interface UserAccountManagerpublic Iterable<UserAccount> findDisabled()
UserAccountManagerUserAccounts.findDisabled in interface UserAccountManagerpublic Optional<UserAccount> findByUsername(String username)
UserAccountManagerfindByUsername in interface UserAccountManagerusername - must not be null or empty.Copyright © 2014 Pivotal Software, Inc.. All rights reserved.