java.lang.Object
com.irurueta.authserver.authorization.application.totp.EnrollTotpUseCase

@Service @Transactional public class EnrollTotpUseCase extends Object
Use case that starts the enrolment of an authenticator app: it generates a secret, stores it encrypted and unconfirmed (replacing any earlier unconfirmed one) and returns the otpauth:// URI to show as a QR code.
  • Field Details

    • totpCredentialRepository

      private final TotpCredentialRepository totpCredentialRepository
      Port that stores the TOTP credentials.
    • totpSecretCipher

      private final TotpSecretCipher totpSecretCipher
      Port that encrypts the secrets at rest.
    • secretGenerator

      private final SecretGenerator secretGenerator
      Generator of the shared secrets.
    • clock

      private final Clock clock
      Source of the current time.
    • mfaProperties

      private final MfaProperties mfaProperties
      Multi-factor settings: the issuer shown by the authenticator app.
  • Constructor Details

    • EnrollTotpUseCase

      public EnrollTotpUseCase()
  • Method Details

    • execute

      public String execute(UUID userId, String username)
      Starts the enrolment.
      Parameters:
      userId - identifier of the user.
      username - name of the user, shown by the authenticator app.
      Returns:
      the otpauth:// URI.
      Throws:
      TotpAlreadyEnabledException - if the user already confirmed an authenticator app.