Class SecondFactorRequiredException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.security.core.AuthenticationException
org.springframework.security.oauth2.core.OAuth2AuthenticationException
com.irurueta.authserver.authorization.api.web.mfa.SecondFactorRequiredException
All Implemented Interfaces:
Serializable

public class SecondFactorRequiredException extends org.springframework.security.oauth2.core.OAuth2AuthenticationException
Raised while an authorization request is validated when the user must present a second factor first. It is not a failure to report to the client: SecondFactorErrorResponseHandler sends the user to the second-factor page instead. A step-up exception (forStepUp()) tells that the request asked for more than the sign-in policy, so a remembered (trusted) device is not enough and the page must ask for a real second factor.
See Also:
  • Field Details

    • ERROR_CODE

      public static final String ERROR_CODE
      Error code of the exception.
      See Also:
    • serialVersionUID

      private static final long serialVersionUID
      Serial version.
      See Also:
    • stepUp

      private final boolean stepUp
      Whether the request asked for a step-up that a remembered device cannot satisfy.
  • Constructor Details

    • SecondFactorRequiredException

      public SecondFactorRequiredException()
      Creates the exception of a sign-in that does not satisfy the policy yet.
    • SecondFactorRequiredException

      private SecondFactorRequiredException(boolean stepUp)
      Creates the exception.
      Parameters:
      stepUp - whether the request asked for a step-up that a remembered device cannot satisfy.
  • Method Details

    • forStepUp

      public static SecondFactorRequiredException forStepUp()
      Creates the exception of a step-up request (acr_values) that needs a real second factor.
      Returns:
      the exception.
    • isStepUp

      public boolean isStepUp()
      Tells whether the request asked for a step-up that a remembered device cannot satisfy.
      Returns:
      true for a step-up.