Class VerifyEmailUseCase
java.lang.Object
com.irurueta.authserver.authorization.application.account.VerifyEmailUseCase
Use case that confirms an e-mail address from the signed token that was mailed to it, which also enables the
account. A token is effective once: presenting it again, even before it expires, is rejected as an invalid token,
so a replayed link can never re-enable an account that was disabled after its verification.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SignedTokenServicePort that verifies the token.private final UserAccountRepositoryPort that stores the accounts. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidVerifies the e-mail address the token was issued for.private static UUIDparseUserId(String subject) Parses the subject of a verified token.
-
Field Details
-
signedTokenService
Port that verifies the token. -
userAccountRepository
Port that stores the accounts.
-
-
Constructor Details
-
VerifyEmailUseCase
public VerifyEmailUseCase()
-
-
Method Details
-
execute
Verifies the e-mail address the token was issued for.- Parameters:
token- the signed verification token.- Throws:
InvalidAccountTokenException- if the token is not valid, or the address was already verified.
-
parseUserId
Parses the subject of a verified token.- Parameters:
subject- the subject.- Returns:
- the user id.
- Throws:
InvalidAccountTokenException- if the subject is not a user id.
-