public static class JWSHeader.Builder extends java.lang.Object
Example use:
JWSHeader header = new JWSHeader.Builder(JWSAlgorithm.HS256). contentType("text/plain"). customParam("exp", new Date().getTime()). build();
Constructor and Description |
---|
JWSHeader.Builder(JWSAlgorithm alg)
Creates a new JWS header builder.
|
JWSHeader.Builder(JWSHeader jwsHeader)
Creates a new JWS header builder with the parameters from
the specified header.
|
Modifier and Type | Method and Description |
---|---|
JWSHeader |
build()
Builds a new JWS header.
|
JWSHeader.Builder |
contentType(java.lang.String cty)
Sets the content type (
cty ) parameter. |
JWSHeader.Builder |
criticalParams(java.util.Set<java.lang.String> crit)
Sets the critical header parameters (
crit )
parameter. |
JWSHeader.Builder |
customParam(java.lang.String name,
java.lang.Object value)
Sets a custom (non-registered) parameter.
|
JWSHeader.Builder |
customParams(java.util.Map<java.lang.String,java.lang.Object> customParameters)
Sets the custom (non-registered) parameters.
|
JWSHeader.Builder |
jwk(JWK jwk)
Sets the JSON Web Key (JWK) (
jwk ) parameter. |
JWSHeader.Builder |
jwkURL(java.net.URL jku)
Sets the JSON Web Key (JWK) Set URL (
jku ) parameter. |
JWSHeader.Builder |
keyID(java.lang.String kid)
Sets the key ID (
kid ) parameter. |
JWSHeader.Builder |
parsedBase64URL(Base64URL base64URL)
Sets the parsed Base64URL.
|
JWSHeader.Builder |
type(JOSEObjectType typ)
Sets the type (
typ ) parameter. |
JWSHeader.Builder |
x509CertChain(java.util.List<Base64> x5c)
Sets the X.509 certificate chain parameter (
x5c )
corresponding to the key used to sign the JWS object. |
JWSHeader.Builder |
x509CertSHA256Thumbprint(Base64URL x5t256)
Sets the X.509 certificate SHA-256 thumbprint
(
x5t#S256 ) parameter. |
JWSHeader.Builder |
x509CertThumbprint(Base64URL x5t)
Sets the X.509 certificate SHA-1 thumbprint (
x5t )
parameter. |
JWSHeader.Builder |
x509CertURL(java.net.URL x5u)
Sets the X.509 certificate URL (
x5u ) parameter. |
public JWSHeader.Builder(JWSAlgorithm alg)
alg
- The JWS algorithm (alg
) parameter. Must
not be "none" or null
.public JWSHeader.Builder(JWSHeader jwsHeader)
jwsHeader
- The JWS header to use. Must not not be
null
.public JWSHeader.Builder type(JOSEObjectType typ)
typ
) parameter.typ
- The type parameter, null
if not
specified.public JWSHeader.Builder contentType(java.lang.String cty)
cty
) parameter.cty
- The content type parameter, null
if not
specified.public JWSHeader.Builder criticalParams(java.util.Set<java.lang.String> crit)
crit
)
parameter.crit
- The names of the critical header parameters,
empty set or null
if none.public JWSHeader.Builder jwkURL(java.net.URL jku)
jku
) parameter.jku
- The JSON Web Key (JWK) Set URL parameter,
null
if not specified.public JWSHeader.Builder jwk(JWK jwk)
jwk
) parameter.jwk
- The JSON Web Key (JWK) (jwk
) parameter,
null
if not specified.public JWSHeader.Builder x509CertURL(java.net.URL x5u)
x5u
) parameter.x5u
- The X.509 certificate URL parameter, null
if not specified.public JWSHeader.Builder x509CertThumbprint(Base64URL x5t)
x5t
)
parameter.x5t
- The X.509 certificate SHA-1 thumbprint parameter,
null
if not specified.public JWSHeader.Builder x509CertSHA256Thumbprint(Base64URL x5t256)
x5t#S256
) parameter.x5t256
- The X.509 certificate SHA-256 thumbprint
parameter, null
if not specified.public JWSHeader.Builder x509CertChain(java.util.List<Base64> x5c)
x5c
)
corresponding to the key used to sign the JWS object.x5c
- The X.509 certificate chain parameter,
null
if not specified.public JWSHeader.Builder keyID(java.lang.String kid)
kid
) parameter.kid
- The key ID parameter, null
if not
specified.public JWSHeader.Builder customParam(java.lang.String name, java.lang.Object value)
name
- The name of the custom parameter. Must not
match a registered parameter name and must not
be null
.value
- The value of the custom parameter, should map
to a valid JSON entity, null
if not
specified.java.lang.IllegalArgumentException
- If the specified parameter
name matches a registered
parameter name.public JWSHeader.Builder customParams(java.util.Map<java.lang.String,java.lang.Object> customParameters)
customParameters
- The custom parameters, empty map or
null
if none.public JWSHeader.Builder parsedBase64URL(Base64URL base64URL)
base64URL
- The parsed Base64URL, null
if the
header is created from scratch.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.