Class CheckSecondFactorLockoutUseCase

java.lang.Object
com.irurueta.authserver.authorization.application.mfa.CheckSecondFactorLockoutUseCase

@Service @Transactional public class CheckSecondFactorLockoutUseCase extends Object
Use case that tells whether the second factor of a user is locked after too many failed attempts. It locks the user's attempt row until the end of the caller's transaction, so the verifications of the same user (each a transactional use case that starts with this check) run one at a time: none of them can pass the check while another one is about to count a failure.
  • Field Details

    • secondFactorAttemptRepository

      private final SecondFactorAttemptRepository secondFactorAttemptRepository
      Port that stores the failed-attempt counters.
    • clock

      private final Clock clock
      Source of the current time.
  • Constructor Details

    • CheckSecondFactorLockoutUseCase

      public CheckSecondFactorLockoutUseCase()
  • Method Details

    • execute

      public boolean execute(UUID userId)
      Checks the lockout of a user.
      Parameters:
      userId - identifier of the user.
      Returns:
      true if the second factor is locked right now.