Enum Class MacAlgorithm

java.lang.Object
java.lang.Enum<MacAlgorithm>
org.springframework.security.oauth2.jose.jws.MacAlgorithm
All Implemented Interfaces:
Serializable, Comparable<MacAlgorithm>, Constable, JwaAlgorithm, JwsAlgorithm

public enum MacAlgorithm extends Enum<MacAlgorithm> implements JwsAlgorithm
An enumeration of the cryptographic algorithms defined by the JSON Web Algorithms (JWA) specification and used by JSON Web Signature (JWS) to create a MAC of the contents of the JWS Protected Header and JWS Payload.
Since:
5.2
See Also:
  • Enum Constant Details

    • HS256

      public static final MacAlgorithm HS256
      HMAC using SHA-256 (Required)
    • HS384

      public static final MacAlgorithm HS384
      HMAC using SHA-384 (Optional)
    • HS512

      public static final MacAlgorithm HS512
      HMAC using SHA-512 (Optional)
  • Method Details

    • values

      public static MacAlgorithm[] 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 MacAlgorithm 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
    • getName

      public String getName()
      Returns the algorithm name.
      Specified by:
      getName in interface JwaAlgorithm
      Returns:
      the algorithm name
    • from

      public static MacAlgorithm from(String name)
      Attempt to resolve the provided algorithm name to a MacAlgorithm.
      Parameters:
      name - the algorithm name
      Returns:
      the resolved MacAlgorithm, or null if not found