Interface UserAccountManagement
Central service to manager
UserAccount
instances.- Author:
- Paul Henke, Oliver Gierke
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changePassword
(UserAccount userAccount, Password.UnencryptedPassword password) Changes the password of theUserAccount
.boolean
contains
(UserAccount.UserAccountIdentifier userAccountIdentifier) Checks if anUserAccount
exists.create
(String userName, Password.UnencryptedPassword password, Iterable<Role> roles) Creates a newUserAccount
from the given username,Password.UnencryptedPassword
and roles.create
(String userName, Password.UnencryptedPassword password, String emailAddress, Iterable<Role> roles) Creates a newUserAccount
from the given username,Password.UnencryptedPassword
, email address and roles.create
(String userName, Password.UnencryptedPassword password, String emailAddress, Role... roles) Creates a newUserAccount
from the given username,Password.UnencryptedPassword
, email address and roles.create
(String userName, Password.UnencryptedPassword password, Role... roles) Creates a newUserAccount
from the given username,Password.UnencryptedPassword
and roles.delete
(UserAccount account) Deletes the givenUserAccount
.void
disable
(UserAccount.UserAccountIdentifier userAccountIdentifier) Disables theUserAccount
.void
enable
(UserAccount.UserAccountIdentifier userAccountIdentifier) Enables theUserAccount
.findAll()
Finds allUserAccount
s.findByUsername
(String username) Returns the user with the given user name.Finds only disabledUserAccount
s.Finds only enabledUserAccount
s.get
(UserAccount.UserAccountIdentifier userAccountIdentifier) Returns anUserAccount
for a given identifier.save
(UserAccount userAccount) Saves theUserAccount
-
Method Details
-
create
Creates a newUserAccount
from the given username,Password.UnencryptedPassword
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.roles
- zero or more roles.- Returns:
- a
UserAccount
, will never be null.
-
create
Creates a newUserAccount
from the given username,Password.UnencryptedPassword
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.roles
- zero or more roles.- Returns:
- a
UserAccount
, will never be null. - Since:
- 7.5
-
create
UserAccount create(String userName, Password.UnencryptedPassword password, String emailAddress, Role... roles) Creates a newUserAccount
from 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
-
create
UserAccount create(String userName, Password.UnencryptedPassword password, String emailAddress, Iterable<Role> roles) Creates a newUserAccount
from 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.5
-
get
Returns anUserAccount
for 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 anUserAccount
exists.- Parameters:
userAccountIdentifier
-- Returns:
- whether a
UserAccount
with the given identifier exists.
-
findAll
Streamable<UserAccount> findAll()Finds allUserAccount
s.- Returns:
- will never be null.
-
findEnabled
Streamable<UserAccount> findEnabled()Finds only enabledUserAccount
s.- Returns:
- will never be null.
-
findDisabled
Streamable<UserAccount> findDisabled()Finds only disabledUserAccount
s.- Returns:
- will never be null.
-
findByUsername
Returns the user with the given user name.- Parameters:
username
- must not be null or empty.- Returns:
- will never be null.
-
delete
Deletes the givenUserAccount
. Note, that other aggregates that keep references to aUserAccount
have to be deleted before aUserAccount
can be deleted in the first place.- Parameters:
account
- must not be null.- Returns:
- the deleted
UserAccount
- Since:
- 7.1
-