Class CountRecoveryCodesUseCase

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

@Service @Transactional(readOnly=true) public class CountRecoveryCodesUseCase extends Object
Use case that counts the recovery codes a user still has, so the UI can warn when few are left.
  • Field Details

    • LOW_THRESHOLD

      public static final int LOW_THRESHOLD
      Number of unused codes at or below which the user is warned to generate new ones.
      See Also:
    • recoveryCodeRepository

      private final RecoveryCodeRepository recoveryCodeRepository
      Port that stores the recovery codes.
  • Constructor Details

    • CountRecoveryCodesUseCase

      public CountRecoveryCodesUseCase()
  • Method Details

    • execute

      public int execute(UUID userId)
      Counts the unused codes.
      Parameters:
      userId - identifier of the user.
      Returns:
      the number of unused codes.