Enum JwtHeaderKey

  • All Implemented Interfaces:
    Serializable, Comparable<JwtHeaderKey>

    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 Detail

      • 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 Detail

      • values

        public static JwtHeaderKey[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (JwtHeaderKey c : JwtHeaderKey.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JwtHeaderKey valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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:
        toString()
      • 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.