Package com.nimbusds.jose.proc
Class DefaultJOSEObjectTypeVerifier<C extends SecurityContext>
- java.lang.Object
-
- com.nimbusds.jose.proc.DefaultJOSEObjectTypeVerifier<C>
-
- 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 Summary
Fields Modifier and Type Field Description static DefaultJOSEObjectTypeVerifierJOSEThe standard header "typ" (type) parameter verifier for JWS, JWE and plain (unsecured) JOSE objects (other than JWT).static DefaultJOSEObjectTypeVerifierJWTThe standard header "typ" (type) parameter verifier for signed, encrypted and plain (unsecured) JWTs.
-
Constructor Summary
Constructors Constructor Description DefaultJOSEObjectTypeVerifier()Creates a new JOSE object type verifier which allows the type to be omitted ornull.DefaultJOSEObjectTypeVerifier(JOSEObjectType... allowedTypes)Creates a new JOSE object type verifier allowing the specified types.DefaultJOSEObjectTypeVerifier(Set<JOSEObjectType> allowedTypes)Creates a new JOSE object type verifier allowing the specified types.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<JOSEObjectType>getAllowedTypes()Returns the allowed JOSE object types.voidverify(JOSEObjectType type, C context)Verifies the JOSE "typ" (type) header parameter.
-
-
-
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 ornull.
-
DefaultJOSEObjectTypeVerifier
public DefaultJOSEObjectTypeVerifier(Set<JOSEObjectType> allowedTypes)
Creates a new JOSE object type verifier allowing the specified types.- Parameters:
allowedTypes- The allowed types, if anullis included the type parameter may be omitted ornull. The set must not benullor empty.
-
DefaultJOSEObjectTypeVerifier
public DefaultJOSEObjectTypeVerifier(JOSEObjectType... allowedTypes)
Creates a new JOSE object type verifier allowing the specified types.- Parameters:
allowedTypes- The allowed types, if anullis included the type parameter may be omitted ornull. The array must not benullor empty.
-
-
Method Detail
-
getAllowedTypes
public Set<JOSEObjectType> getAllowedTypes()
Returns the allowed JOSE object types.- Returns:
- The allowed JOSE object types, if a
nullis included the type parameter may be omitted ornull.
-
verify
public void verify(JOSEObjectType type, C context) throws BadJOSEException
Description copied from interface:JOSEObjectTypeVerifierVerifies the JOSE "typ" (type) header parameter.- Specified by:
verifyin interfaceJOSEObjectTypeVerifier<C extends SecurityContext>- Parameters:
type- The "typ" (type) header parameter,nullif not set.context- Optional context,nullif not required.- Throws:
BadJOSEException- If the type is rejected.
-
-