Class JwsHeader.Builder

java.lang.Object
org.springframework.security.oauth2.jwt.JwsHeader.Builder
Enclosing class:
JwsHeader

public static final class JwsHeader.Builder extends Object
A builder for JwsHeader.
  • Method Details

    • build

      public JwsHeader build()
      Builds a new JwsHeader.
      Returns:
      a JwsHeader
    • getHeaders

      protected Map<String,Object> getHeaders()
    • getThis

      protected final JwsHeader.Builder getThis()
    • algorithm

      public JwsHeader.Builder algorithm(JwaAlgorithm jwaAlgorithm)
      Sets the JWA algorithm used to digitally sign the JWS or encrypt the JWE.
      Parameters:
      jwaAlgorithm - the JwaAlgorithm
      Returns:
      the JoseHeader.AbstractBuilder
    • jwkSetUrl

      public JwsHeader.Builder jwkSetUrl(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 JwsHeader.Builder jwk(Map<String,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 JwsHeader.Builder keyId(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 JwsHeader.Builder x509Url(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 JwsHeader.Builder 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. The certificate or certificate chain is represented as a List of certificate value Strings. Each String in the List is a Base64-encoded DER PKIX certificate value.
      Parameters:
      x509CertificateChain - the X.509 certificate chain
      Returns:
      the JoseHeader.AbstractBuilder
    • x509SHA1Thumbprint

      public JwsHeader.Builder x509SHA1Thumbprint(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 JwsHeader.Builder x509SHA256Thumbprint(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 JwsHeader.Builder type(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 JwsHeader.Builder contentType(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 JwsHeader.Builder 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.
      Parameters:
      name - the critical header name
      value - the critical header value
      Returns:
      the JoseHeader.AbstractBuilder
    • header

      public JwsHeader.Builder header(String name, Object value)
      Sets the header.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      the JoseHeader.AbstractBuilder
    • headers

      public JwsHeader.Builder headers(Consumer<Map<String,Object>> headersConsumer)
      A Consumer to be provided access to the headers allowing the ability to add, replace, or remove.
      Parameters:
      headersConsumer - a Consumer of the headers
      Returns:
      the JoseHeader.AbstractBuilder