Module io.helidon.common.tls
Package io.helidon.common.tls
Class TlsConfig.BuilderBase<BUILDER extends TlsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TlsConfig>
java.lang.Object
io.helidon.common.tls.TlsConfig.BuilderBase<BUILDER,PROTOTYPE>
- Type Parameters:
BUILDER
- type of the builder extending this abstract builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,
,PROTOTYPE> Prototype.ConfiguredBuilder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
TlsConfig.Builder
- Enclosing interface:
TlsConfig
public abstract static class TlsConfig.BuilderBase<BUILDER extends TlsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TlsConfig>
extends Object
implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
Tls
.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddApplicationProtocol
(String applicationProtocol) Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).addApplicationProtocols
(List<? extends String> applicationProtocols) Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).addEnabledCipherSuite
(String enabledCipherSuite) Enabled cipher suites for TLS communication.addEnabledCipherSuites
(List<? extends String> enabledCipherSuites) Enabled cipher suites for TLS communication.addEnabledProtocol
(String enabledProtocol) Enabled protocols for TLS communication.addEnabledProtocols
(List<? extends String> enabledProtocols) Enabled protocols for TLS communication.addPrivateKeyCertChain
(X509Certificate privateKeyCertChain) Certificate chain of the private key.addPrivateKeyCertChain
(List<? extends X509Certificate> privateKeyCertChain) Certificate chain of the private key.addTrust
(X509Certificate trust) List of certificates that form the trust manager.addTrust
(List<? extends X509Certificate> trust) List of certificates that form the trust manager.Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).applicationProtocols
(List<? extends String> applicationProtocols) Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Configure requirement for mutual TLS.clientAuth
(TlsClientAuth clientAuth) Configure requirement for mutual TLS.config()
If this instance was configured, this would be the config instance used.Update builder from configuration (node of this type).boolean
enabled()
Flag indicating whether Tls is enabled.enabled
(boolean enabled) Flag indicating whether Tls is enabled.Enabled cipher suites for TLS communication.enabledCipherSuites
(List<? extends String> enabledCipherSuites) Enabled cipher suites for TLS communication.Enabled protocols for TLS communication.enabledProtocols
(List<? extends String> enabledProtocols) Enabled protocols for TLS communication.Identification algorithm for SSL endpoints.endpointIdentificationAlgorithm
(String endpointIdentificationAlgorithm) Identification algorithm for SSL endpoints.Update this builder from an existing prototype instance.from
(TlsConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.Provider of the key stores used internally to create a key and trust manager factories.internalKeystoreProvider
(String internalKeystoreProvider) Provider of the key stores used internally to create a key and trust manager factories.Type of the key stores used internally to create a key and trust manager factories.internalKeystoreType
(String internalKeystoreType) Type of the key stores used internally to create a key and trust manager factories.Algorithm of the key manager factory used when private key is defined.keyManagerFactoryAlgorithm
(String keyManagerFactoryAlgorithm) Algorithm of the key manager factory used when private key is defined.Key manager factory provider.keyManagerFactoryProvider
(String keyManagerFactoryProvider) Key manager factory provider.manager()
The Tls manager.manager
(TlsManager manager) The Tls manager.protected void
Handles providers and decorators.Private key to use.privateKey
(Keys privateKeyConfig) Private key to use.privateKey
(PrivateKey privateKey) Private key to use.privateKey
(Consumer<Keys.Builder> consumer) Private key to use.Certificate chain of the private key.privateKeyCertChain
(Keys privateKeyCertChainConfig) Certificate chain of the private key.privateKeyCertChain
(Consumer<Keys.Builder> consumer) Certificate chain of the private key.privateKeyCertChain
(List<? extends X509Certificate> privateKeyCertChain) Certificate chain of the private key.protocol()
Configure the protocol used to obtain an instance ofSSLContext
.Configure the protocol used to obtain an instance ofSSLContext
.provider()
Use explicit provider to obtain an instance ofSSLContext
.Use explicit provider to obtain an instance ofSSLContext
.Certificate revocation check configuration.revocation
(RevocationConfig revocation) Certificate revocation check configuration.revocation
(Consumer<RevocationConfig.Builder> consumer) Certificate revocation check configuration.Explicit secure random to use.secureRandom
(SecureRandom secureRandom) Explicit secure random to use.Algorithm to use when creating a new secure random.secureRandomAlgorithm
(String secureRandomAlgorithm) Algorithm to use when creating a new secure random.Provider to use when creating a new secure random.secureRandomProvider
(String secureRandomProvider) Provider to use when creating a new secure random.int
SSL session cache size.sessionCacheSize
(int sessionCacheSize) SSL session cache size.SSL session timeout.sessionTimeout
(Duration sessionTimeout) SSL session timeout.Provide a fully configuredSSLContext
.sslContext
(SSLContext sslContext) Provide a fully configuredSSLContext
.Configure SSL parameters.sslParameters
(SSLParameters sslParameters) Configure SSL parameters.toString()
trust()
List of certificates that form the trust manager.List of certificates that form the trust manager.trust
(Consumer<Keys.Builder> consumer) List of certificates that form the trust manager.trust
(List<? extends X509Certificate> trust) List of certificates that form the trust manager.boolean
trustAll()
Trust any certificate provided by the other side of communication.trustAll
(boolean trustAll) Trust any certificate provided by the other side of communication.Trust manager factory algorithm.trustManagerFactoryAlgorithm
(String trustManagerFactoryAlgorithm) Trust manager factory algorithm.Trust manager factory provider to use.trustManagerFactoryProvider
(String trustManagerFactoryProvider) Trust manager factory provider to use.protected void
Validates required properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
Methods inherited from interface io.helidon.builder.api.Prototype.ConfiguredBuilder
discoverService, discoverServices
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
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
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
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 interfacePrototype.ConfiguredBuilder<BUILDER extends TlsConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends TlsConfig> - Parameters:
config
- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
clearSslContext
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
sslContext
Provide a fully configuredSSLContext
. If defined, context related configuration is ignored.- Parameters:
sslContext
- SSL context to use- Returns:
- updated builder instance
- See Also:
-
clearPrivateKey
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
privateKey
Private key to use. For server side TLS, this is required. For client side TLS, this is optional (used when mutual TLS is enabled).- Parameters:
privateKey
- private key to use- Returns:
- updated builder instance
- See Also:
-
privateKey
Private key to use. For server side TLS, this is required. For client side TLS, this is optional (used when mutual TLS is enabled).- Parameters:
privateKeyConfig
- private key to use- Returns:
- updated builder instance
- See Also:
-
privateKey
Private key to use. For server side TLS, this is required. For client side TLS, this is optional (used when mutual TLS is enabled).- Parameters:
consumer
- private key to use- Returns:
- updated builder instance
- See Also:
-
privateKeyCertChain
Certificate chain of the private key.- Parameters:
privateKeyCertChain
- private key certificate chain, only used when private key is configured- Returns:
- updated builder instance
- See Also:
-
addPrivateKeyCertChain
Certificate chain of the private key.- Parameters:
privateKeyCertChain
- private key certificate chain, only used when private key is configured- Returns:
- updated builder instance
- See Also:
-
privateKeyCertChain
Certificate chain of the private key.- Parameters:
privateKeyCertChainConfig
- private key certificate chain, only used when private key is configured- Returns:
- updated builder instance
- See Also:
-
addPrivateKeyCertChain
Certificate chain of the private key.- Parameters:
privateKeyCertChain
- private key certificate chain, only used when private key is configured- Returns:
- updated builder instance
- See Also:
-
privateKeyCertChain
Certificate chain of the private key.- Parameters:
consumer
- private key certificate chain, only used when private key is configured- Returns:
- updated builder instance
- See Also:
-
trust
List of certificates that form the trust manager.- Parameters:
trust
- certificates to be trusted- Returns:
- updated builder instance
- See Also:
-
addTrust
List of certificates that form the trust manager.- Parameters:
trust
- certificates to be trusted- Returns:
- updated builder instance
- See Also:
-
trust
List of certificates that form the trust manager.- Parameters:
trustConfig
- certificates to be trusted- Returns:
- updated builder instance
- See Also:
-
addTrust
List of certificates that form the trust manager.- Parameters:
trust
- certificates to be trusted- Returns:
- updated builder instance
- See Also:
-
trust
List of certificates that form the trust manager.- Parameters:
consumer
- certificates to be trusted- Returns:
- updated builder instance
- See Also:
-
manager
The Tls manager. If one is not explicitly defined in the config then a default manager will be created.- Parameters:
manager
- the tls manager of the tls instance- Returns:
- updated builder instance
- See Also:
-
clearSecureRandom
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
secureRandom
Explicit secure random to use.- Parameters:
secureRandom
- secure random to use- Returns:
- updated builder instance
- See Also:
-
clearSslParameters
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
sslParameters
Configure SSL parameters. This will always have a value, as we compute ssl parameters in a builder interceptor from configured options.- Parameters:
sslParameters
- SSL parameters to use- Returns:
- updated builder instance
- See Also:
-
clearSecureRandomProvider
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
secureRandomProvider
Provider to use when creating a new secure random. When defined,secureRandomAlgorithm()
must be defined as well.- Parameters:
secureRandomProvider
- provider to use, by default no provider is specified- Returns:
- updated builder instance
- See Also:
-
clearSecureRandomAlgorithm
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
secureRandomAlgorithm
Algorithm to use when creating a new secure random.- Parameters:
secureRandomAlgorithm
- algorithm to use, by default usesSecureRandom
constructor- Returns:
- updated builder instance
- See Also:
-
clearKeyManagerFactoryAlgorithm
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
keyManagerFactoryAlgorithm
Algorithm of the key manager factory used when private key is defined. Defaults toKeyManagerFactory.getDefaultAlgorithm()
.- Parameters:
keyManagerFactoryAlgorithm
- algorithm to use- Returns:
- updated builder instance
- See Also:
-
clearKeyManagerFactoryProvider
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
keyManagerFactoryProvider
Key manager factory provider.- Parameters:
keyManagerFactoryProvider
- provider to use- Returns:
- updated builder instance
- See Also:
-
clearTrustManagerFactoryAlgorithm
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
trustManagerFactoryAlgorithm
Trust manager factory algorithm.- Parameters:
trustManagerFactoryAlgorithm
- algorithm to use- Returns:
- updated builder instance
- See Also:
-
clearTrustManagerFactoryProvider
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
trustManagerFactoryProvider
Trust manager factory provider to use.- Parameters:
trustManagerFactoryProvider
- provider to use- Returns:
- updated builder instance
- See Also:
-
applicationProtocols
Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).- Parameters:
applicationProtocols
- application protocols- Returns:
- updated builder instance
- See Also:
-
addApplicationProtocols
Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).- Parameters:
applicationProtocols
- application protocols- Returns:
- updated builder instance
- See Also:
-
addApplicationProtocol
Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).- Parameters:
applicationProtocol
- application protocols- Returns:
- updated builder instance
- See Also:
-
endpointIdentificationAlgorithm
Identification algorithm for SSL endpoints.- Parameters:
endpointIdentificationAlgorithm
- configure endpoint identification algorithm, or set toNONE
to disable endpoint identification (equivalent to hostname verification). Defaults to "HTTPS"- Returns:
- updated builder instance
- See Also:
-
enabled
Flag indicating whether Tls is enabled.- Parameters:
enabled
- enabled flag- Returns:
- updated builder instance
- See Also:
-
trustAll
Trust any certificate provided by the other side of communication.This is a dangerous setting: if set to
true
, any certificate will be accepted, throwing away most of the security advantages of TLS. NEVER do this in production.- Parameters:
trustAll
- whether to trust all certificates, do not use in production- Returns:
- updated builder instance
- See Also:
-
clientAuth
Configure requirement for mutual TLS.- Parameters:
clientAuth
- what type of mutual TLS to use, defaults toTlsClientAuth.NONE
- Returns:
- updated builder instance
- See Also:
-
protocol
Configure the protocol used to obtain an instance ofSSLContext
.- Parameters:
protocol
- protocol to use, defaults to "TLS"- Returns:
- updated builder instance
- See Also:
-
clearProvider
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
provider
Use explicit provider to obtain an instance ofSSLContext
.- Parameters:
provider
- provider to use, defaults to none (onlyprotocol()
is used by default)- Returns:
- updated builder instance
- See Also:
-
enabledCipherSuites
Enabled cipher suites for TLS communication.- Parameters:
enabledCipherSuites
- cipher suites to enable, by default (or if list is empty), all available cipher suites are enabled- Returns:
- updated builder instance
- See Also:
-
addEnabledCipherSuites
Enabled cipher suites for TLS communication.- Parameters:
enabledCipherSuites
- cipher suites to enable, by default (or if list is empty), all available cipher suites are enabled- Returns:
- updated builder instance
- See Also:
-
addEnabledCipherSuite
Enabled cipher suites for TLS communication.- Parameters:
enabledCipherSuite
- cipher suites to enable, by default (or if list is empty), all available cipher suites are enabled- Returns:
- updated builder instance
- See Also:
-
enabledProtocols
Enabled protocols for TLS communication. Example of valid values forTLS
protocol:TLSv1.3
,TLSv1.2
- Parameters:
enabledProtocols
- protocols to enable, by default (or if list is empty), all available protocols are enabled- Returns:
- updated builder instance
- See Also:
-
addEnabledProtocols
Enabled protocols for TLS communication. Example of valid values forTLS
protocol:TLSv1.3
,TLSv1.2
- Parameters:
enabledProtocols
- protocols to enable, by default (or if list is empty), all available protocols are enabled- Returns:
- updated builder instance
- See Also:
-
addEnabledProtocol
Enabled protocols for TLS communication. Example of valid values forTLS
protocol:TLSv1.3
,TLSv1.2
- Parameters:
enabledProtocol
- protocols to enable, by default (or if list is empty), all available protocols are enabled- Returns:
- updated builder instance
- See Also:
-
sessionCacheSize
SSL session cache size.- Parameters:
sessionCacheSize
- session cache size, defaults to 20480.- Returns:
- updated builder instance
- See Also:
-
sessionTimeout
SSL session timeout.- Parameters:
sessionTimeout
- session timeout, defaults to "PT24H".- Returns:
- updated builder instance
- See Also:
-
clearInternalKeystoreType
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
internalKeystoreType
Type of the key stores used internally to create a key and trust manager factories.- Parameters:
internalKeystoreType
- keystore type, defaults toKeyStore.getDefaultType()
- Returns:
- updated builder instance
- See Also:
-
clearInternalKeystoreProvider
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
internalKeystoreProvider
Provider of the key stores used internally to create a key and trust manager factories.- Parameters:
internalKeystoreProvider
- keystore provider, if not defined, provider is not specified- Returns:
- updated builder instance
- See Also:
-
clearRevocation
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
revocation
Certificate revocation check configuration.- Parameters:
revocation
- certificate revocation configuration- Returns:
- updated builder instance
- See Also:
-
revocation
Certificate revocation check configuration.- Parameters:
consumer
- certificate revocation configuration- Returns:
- updated builder instance
- See Also:
-
sslContext
Provide a fully configuredSSLContext
. If defined, context related configuration is ignored.- Returns:
- the ssl context
-
privateKey
Private key to use. For server side TLS, this is required. For client side TLS, this is optional (used when mutual TLS is enabled).- Returns:
- the private key
-
privateKeyCertChain
Certificate chain of the private key.- Returns:
- the private key cert chain
-
trust
List of certificates that form the trust manager.- Returns:
- the trust
-
manager
The Tls manager. If one is not explicitly defined in the config then a default manager will be created.- Returns:
- the manager
- See Also:
-
secureRandom
Explicit secure random to use.- Returns:
- the secure random
-
sslParameters
Configure SSL parameters. This will always have a value, as we compute ssl parameters in a builder interceptor from configured options.- Returns:
- the ssl parameters
-
secureRandomProvider
Provider to use when creating a new secure random. When defined,secureRandomAlgorithm()
must be defined as well.- Returns:
- the secure random provider
-
secureRandomAlgorithm
Algorithm to use when creating a new secure random.- Returns:
- the secure random algorithm
-
keyManagerFactoryAlgorithm
Algorithm of the key manager factory used when private key is defined. Defaults toKeyManagerFactory.getDefaultAlgorithm()
.- Returns:
- the key manager factory algorithm
-
keyManagerFactoryProvider
Key manager factory provider.- Returns:
- the key manager factory provider
-
trustManagerFactoryAlgorithm
Trust manager factory algorithm.- Returns:
- the trust manager factory algorithm
-
trustManagerFactoryProvider
Trust manager factory provider to use.- Returns:
- the trust manager factory provider
-
applicationProtocols
Configure list of supported application protocols (such ash2
) for application layer protocol negotiation (ALPN).- Returns:
- the application protocols
-
endpointIdentificationAlgorithm
Identification algorithm for SSL endpoints.- Returns:
- the endpoint identification algorithm
-
enabled
public boolean enabled()Flag indicating whether Tls is enabled.- Returns:
- the enabled
-
trustAll
public boolean trustAll()Trust any certificate provided by the other side of communication.This is a dangerous setting: if set to
true
, any certificate will be accepted, throwing away most of the security advantages of TLS. NEVER do this in production.- Returns:
- the trust all
-
clientAuth
Configure requirement for mutual TLS.- Returns:
- the client auth
-
protocol
Configure the protocol used to obtain an instance ofSSLContext
.- Returns:
- the protocol
-
provider
Use explicit provider to obtain an instance ofSSLContext
.- Returns:
- the provider
-
enabledCipherSuites
Enabled cipher suites for TLS communication.- Returns:
- the enabled cipher suites
-
enabledProtocols
Enabled protocols for TLS communication. Example of valid values forTLS
protocol:TLSv1.3
,TLSv1.2
- Returns:
- the enabled protocols
-
sessionCacheSize
public int sessionCacheSize()SSL session cache size.- Returns:
- the session cache size
-
sessionTimeout
SSL session timeout.- Returns:
- the session timeout
-
internalKeystoreType
Type of the key stores used internally to create a key and trust manager factories.- Returns:
- the internal keystore type
-
internalKeystoreProvider
Provider of the key stores used internally to create a key and trust manager factories.- Returns:
- the internal keystore provider
-
revocation
Certificate revocation check configuration.- Returns:
- the revocation
-
config
If this instance was configured, this would be the config instance used.- Returns:
- config node used to configure this builder, or empty if not configured
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-