Class IsTotpEnabledUseCase

java.lang.Object
com.irurueta.authserver.authorization.application.totp.IsTotpEnabledUseCase
All Implemented Interfaces:
SecondFactorEnrolmentQuery

@Service @Transactional(readOnly=true) public class IsTotpEnabledUseCase extends Object implements SecondFactorEnrolmentQuery
Use case that tells whether a user has a confirmed authenticator app. It is also the TOTP SecondFactorEnrolmentQuery, so a confirmed authenticator app makes the second factor required.
  • Field Details

    • totpCredentialRepository

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

    • IsTotpEnabledUseCase

      public IsTotpEnabledUseCase()
  • Method Details

    • execute

      public boolean execute(UUID userId)
      Tells whether a user has a confirmed authenticator app.
      Parameters:
      userId - identifier of the user.
      Returns:
      true when the user has a credential and it is confirmed; false for a pending enrolment.
    • hasConfirmed

      public boolean hasConfirmed(UUID userId)
      Tells whether a user has confirmed the TOTP second factor.
      Specified by:
      hasConfirmed in interface SecondFactorEnrolmentQuery
      Parameters:
      userId - identifier of the user.
      Returns:
      the same as execute(UUID).