Enum Class JwtHeaderKey

java.lang.Object
java.lang.Enum<JwtHeaderKey>
org.forgerock.json.jose.jwt.JwtHeaderKey
All Implemented Interfaces:
Serializable, Comparable<JwtHeaderKey>, java.lang.constant.Constable

public enum JwtHeaderKey extends Enum<JwtHeaderKey>
An Enum for the JWT Header parameter names.

As described in the JWT specification, the reserved JWT header parameters are listed,

  • "typ"
  • "alg"
Any other header parameter name is deemed as a "custom" header parameter.
Since:
2.0.0
  • Enum Constant Details

    • TYP

      public static final JwtHeaderKey TYP
      Type JWT header parameter..
    • ALG

      public static final JwtHeaderKey ALG
      Algorithm JWT header parameter.
    • CUSTOM

      public static final JwtHeaderKey CUSTOM
      Generic header key for a custom header parameter.
  • Method Details

    • values

      public static JwtHeaderKey[] 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 JwtHeaderKey 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
    • value

      public String value()
      Returns a lowercase String of the JwtHeaderKey constant.
      Returns:
      Lowercase String representation of the constant.
      See Also:
    • getHeaderKey

      public static JwtHeaderKey getHeaderKey(String headerKey)
      Gets the JwtHeaderKey constant that matches the given String.

      If the given String does not match any of the constants, then CUSTOM is returned.

      Parameters:
      headerKey - The String representation of a JwtHeaderKey.
      Returns:
      The matching JwtHeaderKey.
    • toString

      public String toString()
      Turns the JwtHeaderKey constant into a lowercase String.
      Overrides:
      toString in class Enum<JwtHeaderKey>
      Returns:
      Lowercase String representation of the constant.