Class Keys.BuilderBase<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys>

java.lang.Object
io.helidon.common.pki.Keys.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
Keys.Builder
Enclosing interface:
Keys

public abstract static class Keys.BuilderBase<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys> extends Object implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for Keys.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(Keys prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(Keys.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      @Deprecated public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • clearKeystore

      public BUILDER clearKeystore()
      Clear existing value of keystore.
      Returns:
      updated builder instance
      See Also:
    • keystore

      public BUILDER keystore(KeystoreKeys keystore)
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      keystore - keystore configuration
      Returns:
      updated builder instance
      See Also:
    • keystore

      public BUILDER keystore(Consumer<KeystoreKeys.Builder> consumer)
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      consumer - consumer of builder of keystore configuration
      Returns:
      updated builder instance
      See Also:
    • keystore

      public BUILDER keystore(Supplier<? extends KeystoreKeys> supplier)
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      supplier - supplier of keystore configuration
      Returns:
      updated builder instance
      See Also:
    • clearPem

      public BUILDER clearPem()
      Clear existing value of pem.
      Returns:
      updated builder instance
      See Also:
    • pem

      public BUILDER pem(PemKeys pem)
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      pem - pem based definition
      Returns:
      updated builder instance
      See Also:
    • pem

      public BUILDER pem(Consumer<PemKeys.Builder> consumer)
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      consumer - consumer of builder of pem based definition
      Returns:
      updated builder instance
      See Also:
    • pem

      public BUILDER pem(Supplier<? extends PemKeys> supplier)
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      supplier - supplier of pem based definition
      Returns:
      updated builder instance
      See Also:
    • clearPublicKey

      public BUILDER clearPublicKey()
      Clear existing value of publicKey.
      Returns:
      updated builder instance
      See Also:
    • publicKey

      public BUILDER publicKey(PublicKey publicKey)
      The public key of this config if configured.
      Parameters:
      publicKey - the public key of this config or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearPrivateKey

      public BUILDER clearPrivateKey()
      Clear existing value of privateKey.
      Returns:
      updated builder instance
      See Also:
    • privateKey

      public BUILDER privateKey(PrivateKey privateKey)
      The private key of this config if configured.
      Parameters:
      privateKey - the private key of this config or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearPublicCert

      public BUILDER clearPublicCert()
      Clear existing value of publicCert.
      Returns:
      updated builder instance
      See Also:
    • publicCert

      public BUILDER publicCert(X509Certificate publicCert)
      The public X.509 Certificate if configured.
      Parameters:
      publicCert - the public certificate of this config or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearCertChain

      public BUILDER clearCertChain()
      Clear all certChain.
      Returns:
      updated builder instance
      See Also:
    • certChain

      public BUILDER certChain(List<? extends X509Certificate> certChain)
      The X.509 Certificate Chain.
      Parameters:
      certChain - the certificate chain or empty list if not configured
      Returns:
      updated builder instance
      See Also:
    • addCertChain

      public BUILDER addCertChain(List<? extends X509Certificate> certChain)
      The X.509 Certificate Chain.
      Parameters:
      certChain - the certificate chain or empty list if not configured
      Returns:
      updated builder instance
      See Also:
    • addCertChain

      public BUILDER addCertChain(X509Certificate certChain)
      The X.509 Certificate Chain.
      Parameters:
      certChain - add single the certificate chain or empty list if not configured
      Returns:
      updated builder instance
      See Also:
    • clearCerts

      public BUILDER clearCerts()
      Clear all certs.
      Returns:
      updated builder instance
      See Also:
    • certs

      public BUILDER certs(List<? extends X509Certificate> certs)
      The X.509 Certificates.
      Parameters:
      certs - the certificates configured or empty list if none configured
      Returns:
      updated builder instance
      See Also:
    • addCerts

      public BUILDER addCerts(List<? extends X509Certificate> certs)
      The X.509 Certificates.
      Parameters:
      certs - the certificates configured or empty list if none configured
      Returns:
      updated builder instance
      See Also:
    • addCert

      public BUILDER addCert(X509Certificate cert)
      The X.509 Certificates.
      Parameters:
      cert - add single the certificates configured or empty list if none configured
      Returns:
      updated builder instance
      See Also:
    • keystore

      public Optional<KeystoreKeys> keystore()
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Returns:
      keystore configuration
    • pem

      public Optional<PemKeys> pem()
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Returns:
      pem based definition
    • publicKey

      public Optional<PublicKey> publicKey()
      The public key of this config if configured.
      Returns:
      the public key of this config or empty if not configured
    • privateKey

      public Optional<PrivateKey> privateKey()
      The private key of this config if configured.
      Returns:
      the private key of this config or empty if not configured
    • publicCert

      public Optional<X509Certificate> publicCert()
      The public X.509 Certificate if configured.
      Returns:
      the public certificate of this config or empty if not configured
    • certChain

      public List<X509Certificate> certChain()
      The X.509 Certificate Chain.
      Returns:
      the certificate chain or empty list if not configured
    • certs

      public List<X509Certificate> certs()
      The X.509 Certificates.
      Returns:
      the certificates configured or empty list if none configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
    • config

      protected Optional<Config> config()
      Configuration used to configure this instance.
      Returns:
      config instance