Class JwkRSA.Builder

java.lang.Object
io.helidon.security.jwt.jwk.JwkRSA.Builder
All Implemented Interfaces:
Builder<JwkRSA.Builder,JwkRSA>, Supplier<JwkRSA>
Enclosing class:
JwkRSA

public static final class JwkRSA.Builder extends Object implements Builder<JwkRSA.Builder,JwkRSA>
Builder for JwkRSA.
  • Method Details

    • privateKey

      public JwkRSA.Builder privateKey(RSAPrivateKey privateKey)
      Set the private key to be used for performing security operations requiring private key, such as signing data, encrypting/decrypting data etc.
      Parameters:
      privateKey - RSA private key instance
      Returns:
      updated builder instance
    • publicKey

      public JwkRSA.Builder publicKey(RSAPublicKey publicKey)
      Set the public key to be used for performing security operations requiring public key, such as signature verification, encrypting/decrypting data etc.
      Parameters:
      publicKey - RSA public key instance
      Returns:
      updated builder instance
    • fromJson

      public JwkRSA.Builder fromJson(JsonObject json)
      Update this builder from JWK in json format.
      Parameters:
      json - JsonObject with the JWK
      Returns:
      updated builder instance, just call build() to build the JwkRSA instance
      See Also:
    • build

      public JwkRSA build()
      Build a new JwkRSA instance from this builder.
      Specified by:
      build in interface Builder<JwkRSA.Builder,JwkRSA>
      Returns:
      instance of JwkRSA configured from this builder
    • certificateChain

      public JwkRSA.Builder certificateChain(List<X509Certificate> chain)
      Set certificate chain of the JWK to be built.
      Parameters:
      chain - certificate chain, where the certificate of this JWK's public must be the first in the list
      Returns:
      updated builder instance
    • addCertificateChain

      public JwkRSA.Builder addCertificateChain(X509Certificate cert)
      Add a certificate to certificate chain of the JWK to be built.
      Parameters:
      cert - certificate to add to the chain
      Returns:
      updated builder instance
    • sha1Thumbprint

      public JwkRSA.Builder sha1Thumbprint(byte[] thumbprint)
      Thumbprint (X.509 Certificate SHA-1 Thumbprint) of the DER encoding of the certificate. Sometimes referred to as fingerprint.
      Parameters:
      thumbprint - thumbprint bytes (raw bytes)
      Returns:
      updated builder instance
    • sha256Thumbprint

      public JwkRSA.Builder sha256Thumbprint(byte[] thumbprint)
      Thumbprint (X.509 Certificate SHA-256 Thumbprint) of the DER encoding of the certificate. Sometimes referred to as fingerprint.
      Parameters:
      thumbprint - thumbprint bytes (raw bytes)
      Returns:
      updated builder instance
    • keyType

      public JwkRSA.Builder keyType(String keyType)
      Key type of the key being built.
      Parameters:
      keyType - one of supported key types
      Returns:
      updated builder instance
      See Also:
    • keyId

      public JwkRSA.Builder keyId(String keyId)
      Key id of the key being built. Note that within one set of keys JwkKeys this must be unique.
      Parameters:
      keyId - key id to map from a signed entity (such as JWT) to JWK definition
      Returns:
      updated builder instance
    • algorithm

      public JwkRSA.Builder algorithm(String algorithm)
      Algorithm of the key being built. Algorithm is optional (each type may have a reasonable default).
      Parameters:
      algorithm - see each key type for supported algorithms
      Returns:
      updated builder instance
      See Also:
    • usage

      public JwkRSA.Builder usage(String usage)
      Intended usage of this JWK. You may configure usage, operations or neither (never both).
      Parameters:
      usage - usage of this JWK
      Returns:
      updated builder instance
      See Also:
    • operations

      public JwkRSA.Builder operations(List<String> operations)
      Intended operations of this JWK. You may configure operations, usage or neither (never both).
      Parameters:
      operations - operations to use, replaces existing operations
      Returns:
      updated builder instance
    • addOperation

      public JwkRSA.Builder addOperation(String operation)
      Add intended operation of this JWK. You may configure operations, usage or neither (never both).
      Parameters:
      operation - operation to add to list of operations
      Returns:
      updated builder instance