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
FieldsModifier and TypeFieldDescriptionstatic final DefaultJOSEObjectTypeVerifierThe standard header "typ" (type) parameter verifier for JWS, JWE and plain (unsecured) JOSE objects (other than JWT).static final DefaultJOSEObjectTypeVerifierThe standard header "typ" (type) parameter verifier for signed, encrypted and plain (unsecured) JWTs. -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionReturns the allowed JOSE object types.voidverify(JOSEObjectType type, C context) Verifies the JOSE "typ" (type) header parameter.
-
Field Details
-
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
The standard header "typ" (type) parameter verifier for signed, encrypted and plain (unsecured) JWTs. See RFC 7519, section 5.1.
-
-
Constructor Details
-
DefaultJOSEObjectTypeVerifier
public DefaultJOSEObjectTypeVerifier()Creates a new JOSE object type verifier which allows the type to be omitted ornull. -
DefaultJOSEObjectTypeVerifier
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
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 Details
-
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
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.
-