Class DefaultJOSEObjectTypeVerifier<C extends SecurityContext>

  • All Implemented Interfaces:
    JOSEObjectTypeVerifier<C>

    @Immutable
    public class DefaultJOSEObjectTypeVerifier<C extends SecurityContext>
    extends Object
    implements JOSEObjectTypeVerifier<C>
    Default JOSE header "typ" (type) parameter verifier.

    Example JWS header with a "typ" (type) parameter set to "at+jwt":

     {
       "alg" : "ES256",
       "typ" : "at+jwt",
       "kid" : "123"
     }
     

    To create a verifier which allows the "typ" to be omitted or set to "JWT":

     JOSEObjectVerifier verifier = new DefaultJOSEObjectTypeVerifier(JOSEObjectType.JWT, null);
     

    To create a verifier which allows a "typ" of "at+jwt":

     JOSEObjectVerifier verifier = new DefaultJOSEObjectTypeVerifier(new JOSEObjectType("at+jwt")));
     
    Since:
    8.0
    Version:
    2019-10-15
    Author:
    Vladimir Dzhuvinov
    • Field Detail

      • JOSE

        public static final DefaultJOSEObjectTypeVerifier JOSE
        The standard header "typ" (type) parameter verifier for JWS, JWE and plain (unsecured) JOSE objects (other than JWT). See RFC 7515, section 4.1.9 and RFC 7516, section 4.1.11.
      • JWT

        public static final DefaultJOSEObjectTypeVerifier JWT
        The standard header "typ" (type) parameter verifier for signed, encrypted and plain (unsecured) JWTs. See RFC 7519, section 5.1.
    • Constructor Detail

      • DefaultJOSEObjectTypeVerifier

        public DefaultJOSEObjectTypeVerifier()
        Creates a new JOSE object type verifier which allows the type to be omitted or null.
      • DefaultJOSEObjectTypeVerifier

        public DefaultJOSEObjectTypeVerifier​(Set<JOSEObjectType> allowedTypes)
        Creates a new JOSE object type verifier allowing the specified types.
        Parameters:
        allowedTypes - The allowed types, if a null is included the type parameter may be omitted or null. The set must not be null or empty.
      • DefaultJOSEObjectTypeVerifier

        public DefaultJOSEObjectTypeVerifier​(JOSEObjectType... allowedTypes)
        Creates a new JOSE object type verifier allowing the specified types.
        Parameters:
        allowedTypes - The allowed types, if a null is included the type parameter may be omitted or null. The array must not be null or empty.