java.lang.Object
io.helidon.common.tls.ConfiguredTlsManager
- All Implemented Interfaces:
NamedService
,TlsManager
The default configured
TlsManager
implementation.-
Constructor Summary
ModifierConstructorDescriptionprotected
ConfiguredTlsManager
(String name, String type) Configured tls manager constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyManagerFactory
buildKmf
(TlsConfig target, SecureRandom secureRandom, PrivateKey privateKey, Certificate[] certificates) Build the key manager factory.protected TrustManagerFactory
Create a new trust manager factory based on the configuration (i.e., the algorithm and provider).void
Always called before any other method on this type.protected void
initializeTmf
(TrustManagerFactory tmf, KeyStore keyStore, TlsConfig tlsConfig) Perform initialization of theTrustManagerFactory
based on the provided TLS configuration.protected void
initSslContext
(TlsConfig tlsConfig, SecureRandom secureRandom, KeyManager[] keyManagers, TrustManager[] trustManagers) Initialize and set theSSLContext
on this manager instance.protected KeyStore
internalKeystore
(TlsConfig tlsConfig) Creates an internal keystore and loads it with no password and no data.The key manager in use.name()
Name of this implementation, as provided inConfiguredProvider.create(Config, String)
.void
This method will multiplex the call to allTlsReloadableComponent
s that are being managed by this manager.protected void
reload
(Optional<X509KeyManager> keyManager, Optional<X509TrustManager> trustManager) Reload the current SSL context with the provided key manager and trust manager (if defined).protected SecureRandom
secureRandom
(TlsConfig tlsConfig) Load secure random.SSL context created by this manager.protected TrustManagerFactory
Creates a trust all trust manager factory.The trust manager in use.type()
Type of this implementation, to distinguish instances of same type, with differentNamedService.name()
.
-
Constructor Details
-
ConfiguredTlsManager
Configured tls manager constructor.- Parameters:
name
- the manager nametype
- the manager type
-
-
Method Details
-
name
Description copied from interface:NamedService
Name of this implementation, as provided inConfiguredProvider.create(Config, String)
.- Specified by:
name
in interfaceNamedService
- Returns:
- name of this service
-
type
Description copied from interface:NamedService
Type of this implementation, to distinguish instances of same type, with differentNamedService.name()
. Use for exampleConfiguredProvider.configKey()
to define the type.- Specified by:
type
in interfaceNamedService
- Returns:
- type of this service
-
sslContext
Description copied from interface:TlsManager
SSL context created by this manager. This method is called only afterTlsManager.init(TlsConfig)
and only ifTlsConfigBlueprint.enabled()
istrue
.- Specified by:
sslContext
in interfaceTlsManager
- Returns:
- the SSL context to use
-
init
Description copied from interface:TlsManager
Always called before any other method on this type. This method is only called when TLS is enabled. In case the TLS is disabled, none of the methods on this type can be called.- Specified by:
init
in interfaceTlsManager
- Parameters:
tlsConfig
- TLS configuration
-
reload
Description copied from interface:TlsManager
This method will multiplex the call to allTlsReloadableComponent
s that are being managed by this manager.- Specified by:
reload
in interfaceTlsManager
- Parameters:
tls
- the new tls instance- See Also:
-
keyManager
Description copied from interface:TlsManager
The key manager in use.- Specified by:
keyManager
in interfaceTlsManager
- Returns:
- key manager
-
trustManager
Description copied from interface:TlsManager
The trust manager in use.- Specified by:
trustManager
in interfaceTlsManager
- Returns:
- trust manager
-
reload
Reload the current SSL context with the provided key manager and trust manager (if defined).- Parameters:
keyManager
- key manager to usetrustManager
- trust manager to use
-
initSslContext
protected void initSslContext(TlsConfig tlsConfig, SecureRandom secureRandom, KeyManager[] keyManagers, TrustManager[] trustManagers) Initialize and set theSSLContext
on this manager instance.- Parameters:
tlsConfig
- the tls configurationsecureRandom
- the secure randomkeyManagers
- the key managerstrustManagers
- the trust managers
-
secureRandom
Load secure random.- Parameters:
tlsConfig
- TLS configuration- Returns:
- secure random
-
buildKmf
protected KeyManagerFactory buildKmf(TlsConfig target, SecureRandom secureRandom, PrivateKey privateKey, Certificate[] certificates) Build the key manager factory.- Parameters:
target
- the tls configurationsecureRandom
- the secure randomprivateKey
- the private key for the key storecertificates
- the certificates for the keystore- Returns:
- a key manager factory instance
-
internalKeystore
Creates an internal keystore and loads it with no password and no data.- Parameters:
tlsConfig
- TLS config- Returns:
- a new keystore
-
createTmf
Create a new trust manager factory based on the configuration (i.e., the algorithm and provider).- Parameters:
tlsConfig
- TLS config- Returns:
- a new trust manager factory
-
initializeTmf
Perform initialization of theTrustManagerFactory
based on the provided TLS configuration.- Parameters:
tmf
- trust manager factory to be initializedkeyStore
- keystoretlsConfig
- tls configuration
-
trustAllTmf
Creates a trust all trust manager factory.- Returns:
- a new trust manager factory trusting all
-