java.lang.Object
com.irurueta.authserver.authorization.application.account.VerifyEmailUseCase

@Service public class VerifyEmailUseCase extends Object
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 Details

    • signedTokenService

      private final SignedTokenService signedTokenService
      Port that verifies the token.
    • userAccountRepository

      private final UserAccountRepository userAccountRepository
      Port that stores the accounts.
  • Constructor Details

    • VerifyEmailUseCase

      public VerifyEmailUseCase()
  • Method Details

    • execute

      @Transactional public void execute(String token)
      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

      private static UUID parseUserId(String subject)
      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.