Interface UserAccountManagement
@Service public interface UserAccountManagement
Central service to manager
UserAccount instances.- Author:
- Paul Henke, Oliver Gierke
-
Method Summary
Modifier and Type Method Description voidchangePassword(UserAccount userAccount, Password.UnencryptedPassword password)Changes the password of theUserAccount.booleancontains(UserAccountIdentifier userAccountIdentifier)Checks if anUserAccountexists.UserAccountcreate(String userName, Password.UnencryptedPassword password, String emailAddress, Role... roles)Creates a newUserAccountfrom the given username,Password.UnencryptedPassword, email address and roles.UserAccountcreate(String userName, Password.UnencryptedPassword password, Role... roles)Creates a newUserAccountfrom the given username,Password.UnencryptedPasswordand roles.UserAccountdelete(UserAccount account)Deletes the givenUserAccount.voiddisable(UserAccountIdentifier userAccountIdentifier)Disables theUserAccount.voidenable(UserAccountIdentifier userAccountIdentifier)Enables theUserAccount.Streamable<UserAccount>findAll()Finds allUserAccounts.Optional<UserAccount>findByUsername(String username)Returns the user with the given user name.Streamable<UserAccount>findDisabled()Finds only disabledUserAccounts.Streamable<UserAccount>findEnabled()Finds only enabledUserAccounts.Optional<UserAccount>get(UserAccountIdentifier userAccountIdentifier)Returns anUserAccountfor a given identifier.UserAccountsave(UserAccount userAccount)Saves theUserAccount
-
Method Details
-
create
Creates a newUserAccountfrom the given username,Password.UnencryptedPasswordand roles.- Parameters:
userName- the unique name of the user, the name is also used as login name.password- the unencrypted password which will be encrypted.roles- zero or more roles.- Returns:
- a
UserAccount, will never be null.
-
create
UserAccount create(String userName, Password.UnencryptedPassword password, String emailAddress, Role... roles)Creates a newUserAccountfrom the given username,Password.UnencryptedPassword, email address and roles.- Parameters:
userName- the unique name of the user, the name is also used as login name.password- the unencrypted password which will be encrypted.emailAddress- the email address to be used.roles- zero or more roles.- Returns:
- a
UserAccount, will never be null. - Since:
- 7.1
-
get
Returns anUserAccountfor a given identifier.- Parameters:
userAccountIdentifier-- Returns:
- will never be null.
-
save
Saves theUserAccount- Parameters:
userAccount-- Returns:
- will never be null.
-
enable
Enables theUserAccount.- Parameters:
userAccountIdentifier-
-
disable
Disables theUserAccount.- Parameters:
userAccountIdentifier-
-
changePassword
Changes the password of theUserAccount.- Parameters:
userAccount-password- must not be null.
-
contains
Checks if anUserAccountexists.- Parameters:
userAccountIdentifier-- Returns:
-
findAll
Streamable<UserAccount> findAll()Finds allUserAccounts.- Returns:
-
findEnabled
Streamable<UserAccount> findEnabled()Finds only enabledUserAccounts.- Returns:
-
findDisabled
Streamable<UserAccount> findDisabled()Finds only disabledUserAccounts.- Returns:
-
findByUsername
Returns the user with the given user name.- Parameters:
username- must not be null or empty.- Returns:
-
delete
Deletes the givenUserAccount. Note, that other aggregates that keep references to aUserAccounthave to be deleted before aUserAccountcan be deleted in the first place.- Parameters:
account- must not be null.- Returns:
- the deleted
UserAccount - Since:
- 7.1
-