Class IsUserMfaRequiredUseCase

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

@Service @Transactional(readOnly=true) public class IsUserMfaRequiredUseCase extends Object
Use case that tells whether the account of a user requires a second factor, whatever the client being served: when an administrator forced it (users.mfa_required) or when the user has confirmed a second factor (asked to HasConfirmedSecondFactorUseCase), since a factor the user enrolled must protect every sign-in. The two stay separate: removing the last second factor lifts the second, never the first.
  • Field Details

    • userAccountRepository

      private final UserAccountRepository userAccountRepository
      Port that provides the user accounts.
    • userMfaSettingsRepository

      private final UserMfaSettingsRepository userMfaSettingsRepository
      Port that stores the per-user multi-factor settings.
    • hasConfirmedSecondFactorUseCase

      private final HasConfirmedSecondFactorUseCase hasConfirmedSecondFactorUseCase
      Use case that tells whether the user has confirmed a second factor.
  • Constructor Details

    • IsUserMfaRequiredUseCase

      public IsUserMfaRequiredUseCase()
  • Method Details

    • execute

      public boolean execute(String username)
      Tells whether an account requires a second factor.
      Parameters:
      username - name the user signs in with.
      Returns:
      true when the account exists and either an administrator requires it or the user has a confirmed second factor; false otherwise, or when the account does not exist.