Enum Class MultiFactorCondition

java.lang.Object
java.lang.Enum<MultiFactorCondition>
org.springframework.security.config.annotation.authorization.MultiFactorCondition
All Implemented Interfaces:
Serializable, Comparable<MultiFactorCondition>, Constable

public enum MultiFactorCondition extends Enum<MultiFactorCondition>
Condition under which multi-factor authentication is required.
Since:
7.1
See Also:
  • Enum Constant Details

    • WEBAUTHN_REGISTERED

      public static final MultiFactorCondition WEBAUTHN_REGISTERED
      Require multi-factor authentication only when the user has a WebAuthn credential record registered.

      When this condition is specified, EnableMultiFactorAuthentication.authorities() must include FactorGrantedAuthority.WEBAUTHN_AUTHORITY. Failing to include it results in an IllegalArgumentException when the configuration is processed.

      Using this condition also requires both a PublicKeyCredentialUserEntityRepository Bean and a UserCredentialRepository Bean to be published.

      @Bean
      public PublicKeyCredentialUserEntityRepository userEntityRepository() {
          return new InMemoryPublicKeyCredentialUserEntityRepository();
      }
      
      @Bean
      public UserCredentialRepository userCredentialRepository() {
          return new InMemoryUserCredentialRepository();
      }
      
  • Method Details

    • values

      public static MultiFactorCondition[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MultiFactorCondition valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null