@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) |
Modifier and Type | Method and Description |
---|---|
void |
changePassword(UserAccount userAccount,
String password)
Changes the password of the
UserAccount . |
boolean |
contains(UserAccountIdentifier userAccountIdentifier)
Checks if an
UserAccount exists. |
UserAccount |
create(String userName,
String password,
Role... roles)
Creates a new
UserAccount and persists it right away. |
void |
disable(UserAccountIdentifier userAccountIdentifier)
Disables the
UserAccount . |
void |
enable(UserAccountIdentifier userAccountIdentifier)
Enables the
UserAccount . |
Streamable<UserAccount> |
findAll()
Finds all
UserAccount s. |
Optional<UserAccount> |
findByUsername(String username)
Returns the user with the given user name.
|
Streamable<UserAccount> |
findDisabled()
Finds only disabled
UserAccount s. |
Streamable<UserAccount> |
findEnabled()
Finds only enabled
UserAccount s. |
Optional<UserAccount> |
get(UserAccountIdentifier userAccountIdentifier)
Returns an
UserAccount for a given identifier. |
UserAccount |
save(UserAccount userAccount)
Saves the
UserAccount |
@ConstructorProperties(value={"repository","passwordEncoder"}) @Generated(value="lombok") public PersistentUserAccountManager(@NonNull UserAccountRepository repository, @NonNull org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
@Transactional public UserAccount create(String userName, String password, Role... roles)
UserAccountManager
UserAccount
and persists it right away.create
in interface UserAccountManager
userName
- the unique name of the user, the name is also used as login name.password
- the passwordroles
- zero or more rolesUserAccount
, will never be null.public Optional<UserAccount> get(UserAccountIdentifier userAccountIdentifier)
UserAccountManager
UserAccount
for a given identifier.get
in interface UserAccountManager
@Transactional public UserAccount save(UserAccount userAccount)
UserAccountManager
UserAccount
save
in interface UserAccountManager
@Transactional public void enable(UserAccountIdentifier userAccountIdentifier)
UserAccountManager
UserAccount
.enable
in interface UserAccountManager
@Transactional public void disable(UserAccountIdentifier userAccountIdentifier)
UserAccountManager
UserAccount
.disable
in interface UserAccountManager
@Transactional public void changePassword(UserAccount userAccount, String password)
UserAccountManager
UserAccount
.changePassword
in interface UserAccountManager
public boolean contains(UserAccountIdentifier userAccountIdentifier)
UserAccountManager
UserAccount
exists.contains
in interface UserAccountManager
public Streamable<UserAccount> findAll()
UserAccountManager
UserAccount
s.findAll
in interface UserAccountManager
public Streamable<UserAccount> findEnabled()
UserAccountManager
UserAccount
s.findEnabled
in interface UserAccountManager
public Streamable<UserAccount> findDisabled()
UserAccountManager
UserAccount
s.findDisabled
in interface UserAccountManager
public Optional<UserAccount> findByUsername(String username)
UserAccountManager
findByUsername
in interface UserAccountManager
username
- must not be null or empty.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.