Class JwsHeader.Builder
- java.lang.Object
-
- org.springframework.security.oauth2.jwt.JwsHeader.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description B
algorithm(JwaAlgorithm jwaAlgorithm)
Sets theJWA algorithm
used to digitally sign the JWS or encrypt the JWE.JwsHeader
build()
Builds a newJwsHeader
.B
contentType(java.lang.String contentType)
Sets the content type header that declares the media type of the secured content (the payload).B
criticalHeader(java.lang.String name, java.lang.Object value)
Sets the critical header that indicates which extensions to the JWS/JWE/JWA specifications are being used that MUST be understood and processed.protected java.util.Map<java.lang.String,java.lang.Object>
getHeaders()
protected B
getThis()
B
header(java.lang.String name, java.lang.Object value)
Sets the header.B
headers(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> headersConsumer)
AConsumer
to be provided access to the headers allowing the ability to add, replace, or remove.B
jwk(java.util.Map<java.lang.String,java.lang.Object> jwk)
Sets the JSON Web Key which is the public key that corresponds to the key used to digitally sign the JWS or encrypt the JWE.B
jwkSetUrl(java.lang.String jwkSetUrl)
Sets the JWK Set URL that refers to the resource of a set of JSON-encoded public keys, one of which corresponds to the key used to digitally sign the JWS or encrypt the JWE.B
keyId(java.lang.String keyId)
Sets the key ID that is a hint indicating which key was used to secure the JWS or JWE.B
type(java.lang.String type)
Sets the type header that declares the media type of the JWS/JWE.B
x509CertificateChain(java.util.List<java.lang.String> x509CertificateChain)
Sets the X.509 certificate chain that contains the X.509 public key certificate or certificate chain corresponding to the key used to digitally sign the JWS or encrypt the JWE.B
x509SHA1Thumbprint(java.lang.String x509SHA1Thumbprint)
Sets the X.509 certificate SHA-1 thumbprint that is a base64url-encoded SHA-1 thumbprint (a.k.a.B
x509SHA256Thumbprint(java.lang.String x509SHA256Thumbprint)
Sets the X.509 certificate SHA-256 thumbprint that is a base64url-encoded SHA-256 thumbprint (a.k.a.B
x509Url(java.lang.String x509Url)
Sets the X.509 URL that refers to the resource for the X.509 public key certificate or certificate chain corresponding to the key used to digitally sign the JWS or encrypt the JWE.
-
-
-
Method Detail
-
getHeaders
protected java.util.Map<java.lang.String,java.lang.Object> getHeaders()
-
getThis
protected final B getThis()
-
algorithm
public B algorithm(JwaAlgorithm jwaAlgorithm)
Sets theJWA algorithm
used to digitally sign the JWS or encrypt the JWE.- Parameters:
jwaAlgorithm
- theJwaAlgorithm
- Returns:
- the
JoseHeader.AbstractBuilder
-
jwkSetUrl
public B jwkSetUrl(java.lang.String jwkSetUrl)
Sets the JWK Set URL that refers to the resource of a set of JSON-encoded public keys, one of which corresponds to the key used to digitally sign the JWS or encrypt the JWE.- Parameters:
jwkSetUrl
- the JWK Set URL- Returns:
- the
JoseHeader.AbstractBuilder
-
jwk
public B jwk(java.util.Map<java.lang.String,java.lang.Object> jwk)
Sets the JSON Web Key which is the public key that corresponds to the key used to digitally sign the JWS or encrypt the JWE.- Parameters:
jwk
- the JSON Web Key- Returns:
- the
JoseHeader.AbstractBuilder
-
keyId
public B keyId(java.lang.String keyId)
Sets the key ID that is a hint indicating which key was used to secure the JWS or JWE.- Parameters:
keyId
- the key ID- Returns:
- the
JoseHeader.AbstractBuilder
-
x509Url
public B x509Url(java.lang.String x509Url)
Sets the X.509 URL that refers to the resource for the X.509 public key certificate or certificate chain corresponding to the key used to digitally sign the JWS or encrypt the JWE.- Parameters:
x509Url
- the X.509 URL- Returns:
- the
JoseHeader.AbstractBuilder
-
x509CertificateChain
public B x509CertificateChain(java.util.List<java.lang.String> x509CertificateChain)
Sets the X.509 certificate chain that contains the X.509 public key certificate or certificate chain corresponding to the key used to digitally sign the JWS or encrypt the JWE. The certificate or certificate chain is represented as aList
of certificate valueString
s. EachString
in theList
is a Base64-encoded DER PKIX certificate value.- Parameters:
x509CertificateChain
- the X.509 certificate chain- Returns:
- the
JoseHeader.AbstractBuilder
-
x509SHA1Thumbprint
public B x509SHA1Thumbprint(java.lang.String x509SHA1Thumbprint)
Sets the X.509 certificate SHA-1 thumbprint that is a base64url-encoded SHA-1 thumbprint (a.k.a. digest) of the DER encoding of the X.509 certificate corresponding to the key used to digitally sign the JWS or encrypt the JWE.- Parameters:
x509SHA1Thumbprint
- the X.509 certificate SHA-1 thumbprint- Returns:
- the
JoseHeader.AbstractBuilder
-
x509SHA256Thumbprint
public B x509SHA256Thumbprint(java.lang.String x509SHA256Thumbprint)
Sets the X.509 certificate SHA-256 thumbprint that is a base64url-encoded SHA-256 thumbprint (a.k.a. digest) of the DER encoding of the X.509 certificate corresponding to the key used to digitally sign the JWS or encrypt the JWE.- Parameters:
x509SHA256Thumbprint
- the X.509 certificate SHA-256 thumbprint- Returns:
- the
JoseHeader.AbstractBuilder
-
type
public B type(java.lang.String type)
Sets the type header that declares the media type of the JWS/JWE.- Parameters:
type
- the type header- Returns:
- the
JoseHeader.AbstractBuilder
-
contentType
public B contentType(java.lang.String contentType)
Sets the content type header that declares the media type of the secured content (the payload).- Parameters:
contentType
- the content type header- Returns:
- the
JoseHeader.AbstractBuilder
-
criticalHeader
public B criticalHeader(java.lang.String name, java.lang.Object value)
Sets the critical header that indicates which extensions to the JWS/JWE/JWA specifications are being used that MUST be understood and processed.- Parameters:
name
- the critical header namevalue
- the critical header value- Returns:
- the
JoseHeader.AbstractBuilder
-
header
public B header(java.lang.String name, java.lang.Object value)
Sets the header.- Parameters:
name
- the header namevalue
- the header value- Returns:
- the
JoseHeader.AbstractBuilder
-
headers
public B headers(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> headersConsumer)
AConsumer
to be provided access to the headers allowing the ability to add, replace, or remove.- Parameters:
headersConsumer
- aConsumer
of the headers- Returns:
- the
JoseHeader.AbstractBuilder
-
-