Class JwsHeader.Builder
java.lang.Object
org.springframework.security.oauth2.jwt.JwsHeader.Builder
- Enclosing class:
- JwsHeader
A builder for
JwsHeader
.-
Method Summary
Modifier and TypeMethodDescriptionalgorithm
(JwaAlgorithm jwaAlgorithm) Sets theJWA algorithm
used to digitally sign the JWS or encrypt the JWE.build()
Builds a newJwsHeader
.contentType
(String contentType) Sets the content type header that declares the media type of the secured content (the payload).criticalHeader
(String name, 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 final JwsHeader.Builder
getThis()
Sets the header.AConsumer
to be provided access to the headers allowing the ability to add, replace, or remove.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.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.Sets the key ID that is a hint indicating which key was used to secure the JWS or JWE.Sets the type header that declares the media type of the JWS/JWE.x509CertificateChain
(List<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.x509SHA1Thumbprint
(String x509SHA1Thumbprint) Sets the X.509 certificate SHA-1 thumbprint that is a base64url-encoded SHA-1 thumbprint (a.k.a.x509SHA256Thumbprint
(String x509SHA256Thumbprint) Sets the X.509 certificate SHA-256 thumbprint that is a base64url-encoded SHA-256 thumbprint (a.k.a.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 Details
-
build
Builds a newJwsHeader
.- Returns:
- a
JwsHeader
-
getHeaders
-
getThis
-
algorithm
Sets theJWA algorithm
used to digitally sign the JWS or encrypt the JWE.- Parameters:
jwaAlgorithm
- theJwaAlgorithm
- Returns:
- the
JoseHeader.AbstractBuilder
-
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
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
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
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
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
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
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
Sets the type header that declares the media type of the JWS/JWE.- Parameters:
type
- the type header- Returns:
- the
JoseHeader.AbstractBuilder
-
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
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
Sets the header.- Parameters:
name
- the header namevalue
- the header value- Returns:
- the
JoseHeader.AbstractBuilder
-
headers
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
-