Class RequestPasswordResetUseCase
java.lang.Object
com.irurueta.authserver.authorization.application.account.RequestPasswordResetUseCase
Use case that starts a password reset. It always succeeds from the caller's point of view: an unknown address is
never mailed (so the endpoint cannot be used to send mail to arbitrary addresses) and costs the same token work (a
token is generated and hashed either way), so the response never reveals whether an address is registered. The
token is stored and mailed in one transaction: if the mail cannot be sent, no usable token is left behind.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AccountMailerPort that sends the e-mails.private final AccountTokenRepositoryPort that stores the reset tokens.private final ClockSource of the current time.static final DurationHow long a reset token stays valid.private final TokenGeneratorPort that creates and hashes tokens.private final UserAccountRepositoryPort that stores the accounts. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
RESET_TTL
How long a reset token stays valid. -
userAccountRepository
Port that stores the accounts. -
accountTokenRepository
Port that stores the reset tokens. -
tokenGenerator
Port that creates and hashes tokens. -
accountMailer
Port that sends the e-mails. -
clock
Source of the current time.
-
-
Constructor Details
-
RequestPasswordResetUseCase
public RequestPasswordResetUseCase()
-
-
Method Details
-
execute
Requests a password reset.- Parameters:
email- e-mail address of the user.
-
sendReset
Stores the reset token and mails it.- Parameters:
account- the account to reset.email- address to send the message to.token- the reset token.hashedToken- hash of the reset token.
-