Class ChangePasswordUseCase
java.lang.Object
com.irurueta.authserver.authorization.application.account.ChangePasswordUseCase
Use case that lets a signed-in user choose a new password. Every token of the user is revoked afterwards, in the
same transaction as the password update, so a failed revocation never leaves the new password with the old tokens.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CompromisedPasswordCheckPort that checks passwords against leaked ones.private final PasswordHasherPort that hashes passwords.private final PasswordPolicyRules a new password must follow.private final RevokeUserAuthorizationsUseCaseUse case that revokes the tokens of the user.private final UserAccountRepositoryPort that stores the accounts. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
userAccountRepository
Port that stores the accounts. -
passwordHasher
Port that hashes passwords. -
compromisedPasswordCheck
Port that checks passwords against leaked ones. -
revokeUserAuthorizationsUseCase
Use case that revokes the tokens of the user. -
passwordPolicy
Rules a new password must follow.
-
-
Constructor Details
-
ChangePasswordUseCase
public ChangePasswordUseCase()
-
-
Method Details
-
execute
Changes the password of a user.- Parameters:
username- name of the user.currentPassword- the clear-text current password.newPassword- the clear-text new password.- Throws:
InvalidCredentialsException- if the user is unknown or the current password is wrong.InvalidPasswordException- if the new password breaks the policy.CompromisedPasswordException- if the new password is known to be compromised.
-