Class JsonJWSHeader
- All Implemented Interfaces:
JOSEHeader,JOSEHeaderConfigurator<GenericJWSHeader>,JWSHeader,JWSHeaderConfigurator<GenericJWSHeader>
A generic JWS header implementation used when building or reading JSON JWS objects.
This implementation has the ability to track overlapping parameters
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.jws.GenericJWSHeader
b64, PROCESSED_PARAMETERS -
Constructor Summary
ConstructorsConstructorDescriptionCreates a JSON JWS header.JsonJWSHeader(String alg) Creates a JSON JWS header. -
Method Summary
Modifier and TypeMethodDescriptionaddCustomParameter(String key, Object value) Specifies a custom parameter to add to the header.specifies the cryptographic algorithm to use to secure the JOSE object.Specifies whether the payload should be encoded as Base64URL or processed unencoded.contentType(String cty) Specifies the media type of the JOSE object payload.Specifies the set of custom parameters that must be understood and processed.Specifies the JWK to use to secure the JOSE object.Specifies the JWK Set URL that contains the key to use to secure the JOSE object.Specifies the id of the key to use to secure the JOSE object.voidStarts the parameter overlap recording.Stops the parameter overlap recording and returns the overlapped parameters.Specifies the media type of the complete JOSE object.x509CertificateChain(String[] x5c) Specifies the X.509 certificates chain that corresponds to the key to use to secure the JOSE object.Specifies the X.509 SHA1 thumbprint of the certificate that corresponds to the key to use to secure the JOSE object.x509CertificateSHA256Thumbprint(String x5t_S256) Specifies the X.509 SHA256 thumbprint of the certificate that corresponds to the key to use to secure the JOSE object.x509CertificateURL(URI x5u) Specifies the URL of the X.509 certificate or certificates chain that corresponds to the key to use to secure the JOSE object.Methods inherited from class io.inverno.mod.security.jose.internal.jws.GenericJWSHeader
equals, getProcessedParameters, hashCode, isBase64EncodePayloadMethods inherited from class io.inverno.mod.security.jose.internal.AbstractJOSEHeader
getAlgorithm, getContentType, getCritical, getCustomParameters, getEncoded, getJWK, getJWKSetURL, getKey, getKeyId, getType, getX509CertificateChain, getX509CertificateSHA1Thumbprint, getX509CertificateSHA256Thumbprint, getX509CertificateURL, setEncoded, setKeyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.security.jose.JOSEHeader
getAlgorithm, getContentType, getCritical, getCustomParameters, getEncoded, getJWK, getJWKSetURL, getKey, getKeyId, getType, getX509CertificateChain, getX509CertificateSHA1Thumbprint, getX509CertificateSHA256Thumbprint, getX509CertificateURL
-
Constructor Details
-
JsonJWSHeader
public JsonJWSHeader()Creates a JSON JWS header.
-
JsonJWSHeader
Creates a JSON JWS header.
- Parameters:
alg- a signature JWA algorithm
-
-
Method Details
-
startRecordOverlap
public void startRecordOverlap()Starts the parameter overlap recording.
-
stopRecordOverlap
Stops the parameter overlap recording and returns the overlapped parameters.
- Returns:
- the set of overlapped parameters
-
algorithm
Description copied from interface:JOSEHeaderConfiguratorspecifies the cryptographic algorithm to use to secure the JOSE object.
Depending on the type of JOSE object to build, it might designate a signature or a key management algorithm.
- Specified by:
algorithmin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
algorithmin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
alg- a JWA algorithm- Returns:
- this builder
-
jwkSetURL
Description copied from interface:JOSEHeaderConfiguratorSpecifies the JWK Set URL that contains the key to use to secure the JOSE object.
The URL must points to a set of JSON-encoded public keys.
- Specified by:
jwkSetURLin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
jwkSetURLin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
jku- the JWK Set URL- Returns:
- this builder
-
jwk
Description copied from interface:JOSEHeaderConfiguratorSpecifies the JWK to use to secure the JOSE object.
It is represented as a map to comply with the JOSE object definition, the builder eventually tries to resolve an actual JWK based on these parameters.
- Specified by:
jwkin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
jwkin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
jwk- a JWK as a map- Returns:
- this builder
-
keyId
Description copied from interface:JOSEHeaderConfiguratorSpecifies the id of the key to use to secure the JOSE object.
- Specified by:
keyIdin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
keyIdin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
kid- a key id- Returns:
- this builder
-
x509CertificateURL
Description copied from interface:JOSEHeaderConfiguratorSpecifies the URL of the X.509 certificate or certificates chain that corresponds to the key to use to secure the JOSE object.
The certificates chain located at the URL must be in PEM format. The first certificate in the chain must correspond to the key to use to secure the JOSE object.
- Specified by:
x509CertificateURLin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
x509CertificateURLin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
x5u- a URL- Returns:
- this builder
-
x509CertificateChain
Description copied from interface:JOSEHeaderConfiguratorSpecifies the X.509 certificates chain that corresponds to the key to use to secure the JOSE object.
The certificates chain must be represented as an array of Base64URL encoded DER PKIX certificates. The first certificate in the chain must correspond to the key to use to secure the JOSE object.
- Specified by:
x509CertificateChainin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
x509CertificateChainin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
x5c- a certificates chain- Returns:
- this builder
-
x509CertificateSHA1Thumbprint
Description copied from interface:JOSEHeaderConfiguratorSpecifies the X.509 SHA1 thumbprint of the certificate that corresponds to the key to use to secure the JOSE object.
- Specified by:
x509CertificateSHA1Thumbprintin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
x509CertificateSHA1Thumbprintin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
x5t- an X.509 SHA1 thumbprint- Returns:
- this builder
-
x509CertificateSHA256Thumbprint
Description copied from interface:JOSEHeaderConfiguratorSpecifies the X.509 SHA256 thumbprint of the certificate that corresponds to the key to use to secure the JOSE object.
- Specified by:
x509CertificateSHA256Thumbprintin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
x509CertificateSHA256Thumbprintin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
x5t_S256- an X.509 SHA256 thumbprint- Returns:
- this builder
-
type
Description copied from interface:JOSEHeaderConfiguratorSpecifies the media type of the complete JOSE object.
To keep messages compact in common situations, the
application/prefix of a media type can be omitted when no other/appears in the value.- Specified by:
typein interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
typein classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
typ- a media type- Returns:
- this builder
-
contentType
Description copied from interface:JOSEHeaderConfiguratorSpecifies the media type of the JOSE object payload.
To keep messages compact in common situations, the
application/prefix of a media type can be omitted when no other/appears in the value.The builder might use this media type to determine how to serialize/deserialize a JOSE object payload.
- Specified by:
contentTypein interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
contentTypein classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
cty- a media type- Returns:
- this builder
-
critical
Description copied from interface:JOSEHeaderConfiguratorSpecifies the set of custom parameters that must be understood and processed.
Critical parameters can not be registered JOSE header parameters and they must be present in header's custom parameters.
- Specified by:
criticalin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
criticalin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
crit- a set of custom parameters- Returns:
- this builder
-
addCustomParameter
Description copied from interface:JOSEHeaderConfiguratorSpecifies a custom parameter to add to the header.
- Specified by:
addCustomParameterin interfaceJOSEHeaderConfigurator<GenericJWSHeader>- Overrides:
addCustomParameterin classAbstractJOSEHeader<GenericJWSHeader>- Parameters:
key- the custom parameter namevalue- the custom parameter value- Returns:
- this builder
-
base64EncodePayload
Description copied from interface:JWSHeaderConfiguratorSpecifies whether the payload should be encoded as Base64URL or processed unencoded.
- Specified by:
base64EncodePayloadin interfaceJWSHeaderConfigurator<GenericJWSHeader>- Overrides:
base64EncodePayloadin classGenericJWSHeader- Parameters:
b64- true or null to encode the payload as Base64URL, false otherwise- Returns:
- this builder
-