Enum JwtType

  • All Implemented Interfaces:
    Serializable, Comparable<JwtType>

    public enum JwtType
    extends Enum<JwtType>
    An Enum for the possible types of JWTs.

    There are only three possible types of JWTs, plaintext, signed or encrypted. For non-nested JWTs then the "JWT" type is RECOMMENDED to be used but it is OPTIONAL to set the "typ" property in the JWT header. For nested signed or encrypted JWTs the JWT type MUST be "JWS" and "JWE" respectively and the "typ" property in the JWT header MUST be set.

    Since:
    2.0.0
    • Enum Constant Detail

      • JWT

        public static final JwtType JWT
        Used for plaintext, non-nested signed or non-nested encrypted JWTs.
      • JWS

        public static final JwtType JWS
        Used when signing a nested JWT.
      • JWE

        public static final JwtType JWE
        Used when encrypting a nested JWT.
    • Method Detail

      • values

        public static JwtType[] 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 (JwtType c : JwtType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JwtType 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
      • jwtType

        public static JwtType jwtType​(String jwtType)
        Finds the value of the String representation of the given JWT type.
        Parameters:
        jwtType - The JWT type.
        Returns:
        The JWT type enum.