Class RegisterSecondFactorFailureUseCase

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

@Service @Transactional public class RegisterSecondFactorFailureUseCase extends Object
Use case that counts a failed second-factor attempt and locks the second factor of the user once authserver.mfa.max-failed-attempts consecutive failures are reached. Both the failure and the lockout are audited. The counter is stored, never kept in memory.
  • Field Details

    • secondFactorAttemptRepository

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

      private final RecordSecurityEventUseCase recordSecurityEventUseCase
      Use case that records the audit events.
    • clock

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

      private final MfaProperties mfaProperties
      Multi-factor settings: consecutive failures that lock the second factor and how long it stays locked.
  • Constructor Details

    • RegisterSecondFactorFailureUseCase

      public RegisterSecondFactorFailureUseCase()
  • Method Details

    • execute

      public SecondFactorLockout execute(UUID userId, String username)
      Registers a failed attempt.
      Parameters:
      userId - identifier of the user.
      username - name of the user, for the audit log.
      Returns:
      the state of the counter after the failure.