Class ConfiguredTlsManager
- All Implemented Interfaces:
TlsManager, NamedService
TlsManager implementation.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConfiguredTlsManager(String name, String type) Configured tls manager constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyManagerFactorybuildKmf(TlsConfig target, SecureRandom secureRandom, PrivateKey privateKey, Certificate[] certificates) Build the key manager factory.protected KeyManagerFactorybuildKmf(TlsMaterial target, SecureRandom secureRandom, PrivateKey privateKey, Certificate[] certificates) Build the key manager factory.protected TrustManagerFactoryCreate a new trust manager factory based on the configuration (i.e., the algorithm and provider).protected TrustManagerFactorycreateTmf(TlsMaterial material) Create a new trust manager factory based on the TLS material (i.e., the algorithm and provider).longGeneration of TLS material changes reported by this manager.voidInitializes this manager before any other method is called.protected voidinitializeTmf(TrustManagerFactory tmf, KeyStore keyStore, TlsConfig tlsConfig) Perform initialization of theTrustManagerFactorybased on the provided TLS configuration.protected voidinitializeTmf(TrustManagerFactory tmf, KeyStore keyStore, TlsMaterial material) Perform initialization of theTrustManagerFactorybased on the provided TLS material.protected voidinitSslContext(TlsConfig tlsConfig, SecureRandom secureRandom, KeyManager[] keyManagers, TrustManager[] trustManagers) Initialize and set theSSLContexton this manager instance.protected KeyStoreinternalKeystore(TlsConfig tlsConfig) Creates an internal keystore and loads it with no password and no data.protected KeyStoreinternalKeystore(TlsMaterial material) 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).voidDeprecated, for removal: This API element is subject to removal in a future version.voidreload(TlsMaterial material) This method will multiplex the call to allTlsReloadableComponents that are being managed by this manager.protected voidreload(Optional<X509KeyManager> keyManager, Optional<X509TrustManager> trustManager) Reload the current SSL context with the provided key manager and trust manager (if defined).protected SecureRandomsecureRandom(TlsConfig tlsConfig) Load secure random.protected SecureRandomsecureRandom(TlsMaterial material) Load secure random.SSL context created by this manager.protected TrustManagerFactoryCreates 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
-
-
Method Details
-
name
Description copied from interface:NamedServiceName of this implementation, as provided inConfiguredProvider.create(Config, String).- Specified by:
namein interfaceNamedService- Returns:
- name of this service
-
type
Description copied from interface:NamedServiceType of this implementation, to distinguish instances of same type, with differentNamedService.name(). Use for exampleConfiguredProvider.configKey()to define the type.- Specified by:
typein interfaceNamedService- Returns:
- type of this service
-
sslContext
Description copied from interface:TlsManagerSSL context created by this manager. This method is called only afterTlsManager.init(io.helidon.common.tls.TlsConfig)and only ifTlsConfig.enabled()istrue. The returned context identity must remain stable after the first successful initialization.- Specified by:
sslContextin interfaceTlsManager- Returns:
- the SSL context to use
-
init
Description copied from interface:TlsManagerInitializes this manager before any other method is called. This method is only called when TLS is enabled. In case TLS is disabled, none of the methods on this type can be called.A manager can be shared, so this method may be called more than once. Later calls must not replace state already exposed through an
Tlsinstance. Implementations may ignore later calls or reject incompatible configuration.- Specified by:
initin interfaceTlsManager- Parameters:
tlsConfig- TLS configuration
-
reload
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:TlsManagerThis method will multiplex the call to allTlsReloadableComponents that are being managed by this manager.- Specified by:
reloadin interfaceTlsManager- Parameters:
tls- the new tls instance- See Also:
-
reload
Description copied from interface:TlsManagerThis method will multiplex the call to allTlsReloadableComponents that are being managed by this manager.- Specified by:
reloadin interfaceTlsManager- Parameters:
material- the new TLS material- See Also:
-
generation
public long generation()Description copied from interface:TlsManagerGeneration of TLS material changes reported by this manager.The generation after the manager's first successful initialization is
0. An implementation that overrides this method must advance the value whenever key or trust material changes, including when a reload fails after it may have published a change. A concurrent read must not return while a material change is being published, and every direct or provider-driven material publication path must participate. All post-initialization publication paths must be serialized with the mechanism used by this method.A caller can obtain a coherent snapshot by reading the generation, obtaining the manager state, and then reading the generation again, accepting the snapshot only when both values are equal. An overriding implementation must ensure equal values mean no material publication crossed that interval.
The compatibility default always returns
0. A manager that supports reload but does not override this method does not report those reloads, so its generation may lag behind its current material.- Specified by:
generationin interfaceTlsManager- Returns:
- current TLS material generation
-
keyManager
Description copied from interface:TlsManagerThe key manager in use.- Specified by:
keyManagerin interfaceTlsManager- Returns:
- key manager
-
trustManager
Description copied from interface:TlsManagerThe trust manager in use.- Specified by:
trustManagerin interfaceTlsManager- Returns:
- trust manager
-
reload
Reload the current SSL context with the provided key manager and trust manager (if defined).Subclasses must route every key and trust material publication through this method to retain the inherited
TlsManager.generation()tracking. A subclass that bypasses this method owns the generation contract.- 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 theSSLContexton this manager instance. The first successful initialization retains generation0; later calls are ignored. UseTlsManager.reload(io.helidon.common.tls.TlsMaterial)for later material changes.- 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
-
secureRandom
Load secure random.- Parameters:
material- TLS material- 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
-
buildKmf
protected KeyManagerFactory buildKmf(TlsMaterial target, SecureRandom secureRandom, PrivateKey privateKey, Certificate[] certificates) Build the key manager factory.- Parameters:
target- the TLS materialsecureRandom- the secure randomprivateKey- the private key for the key storecertificates- the certificates for the keystore- Returns:
- a key manager factory instance
-
internalKeystore
-
internalKeystore
Creates an internal keystore and loads it with no password and no data.- Parameters:
material- TLS material- 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
-
createTmf
Create a new trust manager factory based on the TLS material (i.e., the algorithm and provider).- Parameters:
material- TLS material- Returns:
- a new trust manager factory
-
initializeTmf
Perform initialization of theTrustManagerFactorybased on the provided TLS configuration.- Parameters:
tmf- trust manager factory to be initializedkeyStore- keystoretlsConfig- tls configuration
-
initializeTmf
Perform initialization of theTrustManagerFactorybased on the provided TLS material.- Parameters:
tmf- trust manager factory to be initializedkeyStore- keystorematerial- TLS material
-
trustAllTmf
Creates a trust all trust manager factory.- Returns:
- a new trust manager factory trusting all
-