Class JsonJWEHeader
- All Implemented Interfaces:
JOSEHeader,JOSEHeaderConfigurator<GenericJWEHeader>,JWEHeader,JWEHeaderConfigurator<GenericJWEHeader>
A generic JWE header implementation used when building or reading JSON JWE objects.
This implementation has the following abilities:
- track the parameters set in the header to be able to easily determine whether two headers overlap
- merge a header into another
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.jwe.GenericJWEHeader
enc, PROCESSED_PARAMETERS, zip -
Constructor Summary
ConstructorsConstructorDescriptionCreates a JSON JWE header.JsonJWEHeader(String alg, String enc) Creates a JSON JWE 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 the compression algorithm.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 encryption algorithm.Returns the set of parameters sets in the JWE header.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.merge(JsonJWEHeader header) Merges the specified header into this header.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.jwe.GenericJWEHeader
equals, getCompressionAlgorithm, getEncryptionAlgorithm, getProcessedParameters, getRaw, hashCode, setEncoded, setExtraProcessedParameters, setRawMethods inherited from class io.inverno.mod.security.jose.internal.AbstractJOSEHeader
getAlgorithm, getContentType, getCritical, getCustomParameters, getEncoded, getJWK, getJWKSetURL, getKey, getKeyId, getType, getX509CertificateChain, getX509CertificateSHA1Thumbprint, getX509CertificateSHA256Thumbprint, getX509CertificateURL, 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
-
JsonJWEHeader
public JsonJWEHeader()Creates a JSON JWE header.
-
JsonJWEHeader
Creates a JSON JWE header.
- Parameters:
alg- a key management JWA algorithmenc- an encryption JWA algorithm
-
-
Method Details
-
merge
Merges the specified header into this header.
- Parameters:
header- the JSON JWE header to merge- Returns:
- this header after the merge
-
getParametersSet
Returns the set of parameters sets in the JWE header.
- Returns:
- a set of 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<GenericJWEHeader>- Overrides:
algorithmin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
jwkSetURLin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
jwkin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
keyIdin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
x509CertificateURLin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
x509CertificateChainin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
x509CertificateSHA1Thumbprintin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
x509CertificateSHA256Thumbprintin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
typein classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
contentTypein classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
criticalin classAbstractJOSEHeader<GenericJWEHeader>- 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<GenericJWEHeader>- Overrides:
addCustomParameterin classAbstractJOSEHeader<GenericJWEHeader>- Parameters:
key- the custom parameter namevalue- the custom parameter value- Returns:
- this builder
-
encryptionAlgorithm
Description copied from interface:JWEHeaderConfiguratorSpecifies the encryption algorithm.
- Specified by:
encryptionAlgorithmin interfaceJWEHeaderConfigurator<GenericJWEHeader>- Overrides:
encryptionAlgorithmin classGenericJWEHeader- Parameters:
enc- the encryption algorithm- Returns:
- the JWE JOSE header configurator
-
compressionAlgorithm
Description copied from interface:JWEHeaderConfiguratorSpecifies the compression algorithm.
- Specified by:
compressionAlgorithmin interfaceJWEHeaderConfigurator<GenericJWEHeader>- Overrides:
compressionAlgorithmin classGenericJWEHeader- Parameters:
zip- the compression algorithm- Returns:
- the JWE JOSE header configurator
-