public interface UserPasswordManagement
Modifier and Type | Method and Description |
---|---|
void |
changePassword(Long userId,
String newPassword)
Change the password of a user.
|
void |
changePassword(String securityCode,
String newPassword)
Change the password of a user who used the forgotten password feature
(
requestPasswordChange(String) ) to request a new password. |
void |
changePassword(User user,
String newPassword)
Change the password of a user.
|
boolean |
checkAndUpdatePassword(User user,
String password)
Check that the (hashed) password of the user matches the given clear text password.
|
boolean |
checkPassword(Long userId,
String password)
Check that the (hashed) password of the user matches the given clear text password.
|
boolean |
checkPassword(User user,
String password)
Check that the (hashed) password of the user matches the given clear text password.
|
void |
register(PasswordHashFunction hashFunction)
Register a hash function for generating and checking password hashes.
|
void |
requestPasswordChange(String email)
Request a new password for the given user.
|
void |
unregister(PasswordHashFunction hashFunction)
Remove a previously registered password hash function.
|
void |
validatePassword(String newPassword)
Validate that a password matches the minimum security requirements to be used in user
accounts
|
void changePassword(Long userId, String newPassword) throws PasswordValidationException, UserNotFoundException, AuthorizationException, ExternalUserPasswordChangeNotAllowedException
userId
- the ID of the user for whom the password should be changednewPassword
- the new clear text passwordPasswordValidationException
- in case the new password doesn't fulfill the minimum security requirements to be
used in user accountsUserNotFoundException
- in case the user with the given ID does not existAuthorizationException
- in case the current user is not the user with the userId or the current user is
not client admin or internal system userExternalUserPasswordChangeNotAllowedException
- in case the user was provided by the primary external user repositoryvoid changePassword(String securityCode, String newPassword) throws SecurityCodeNotFoundException, PasswordValidationException, ExternalUserPasswordChangeNotAllowedException
requestPasswordChange(String)
) to request a new password.securityCode
- security code created by the forgotten password featurenewPassword
- the new clear text passwordSecurityCodeNotFoundException
- in case the security code does not exist or does not belong to a forgotten
password security codePasswordValidationException
- in case the new password doesn't fulfill the minimum security requirements to be
used in user accountsExternalUserPasswordChangeNotAllowedException
- in case the user was provided by the primary external user repositoryvoid changePassword(User user, String newPassword) throws PasswordValidationException, ExternalUserPasswordChangeNotAllowedException
Change the password of a user.
Note: this method does not check whether the current user is allowed to change the password. Moreover, an existing transaction is required.
user
- the user whose password should be changednewPassword
- the new clear text passwordPasswordValidationException
- in case the new password doesn't fulfill the minimum security requirements to be
used in user accountsExternalUserPasswordChangeNotAllowedException
- in case the user was provided by the primary external user repositoryboolean checkAndUpdatePassword(User user, String password)
Check that the (hashed) password of the user matches the given clear text password. If the password matches it will be checked whether the password should be updated to meet the current security requirements. An update will be necessary if the user's password was created with a hash function other than the current hash function or if the hash function didn't change but was reconfigured to produce a stronger hash value.
Note: if an update of password is necessary the given clear text password is not validated
with validatePassword(String)
. Moreover, an existing transaction is required.
user
- the user whose password should be checked and updatedpassword
- the clear text password to test againstboolean checkPassword(Long userId, String password)
userId
- the ID of the user whose password should be checkedpassword
- the clear text password to test againstboolean checkPassword(User user, String password)
user
- the user whose password should be checkedpassword
- the clear text password to test againstvoid register(PasswordHashFunction hashFunction)
hashFunction
- the function to registervoid requestPasswordChange(String email) throws UserNotFoundException, ExternalUserPasswordChangeNotAllowedException
changePassword(String, String)
.email
- the email of the user requesting the password changeUserNotFoundException
- in case there is no user with that emailExternalUserPasswordChangeNotAllowedException
- in case the user was provided by the primary external user repositoryvoid unregister(PasswordHashFunction hashFunction)
hashFunction
- the hash function to removeIllegalArgumentException
- in case the the built-in default hash function should be removedvoid validatePassword(String newPassword) throws PasswordValidationException
newPassword
- the password to validatePasswordValidationException
- in case the password is not validCopyright © 2019 Communote team. All rights reserved.