Class TlsContextConfiguration
- java.lang.Object
-
- org.kiwiproject.config.TlsContextConfiguration
-
- All Implemented Interfaces:
KeyAndTrustStoreConfigProvider,TrustStoreConfigProvider
public class TlsContextConfiguration extends Object implements KeyAndTrustStoreConfigProvider
Configuration for standard/common properties required for secure TLS connections.As this is a configuration class that supports population from external configuration, it is mutable
NOTE: This requires dropwizard-client as a dependency.
-
-
Constructor Summary
Constructors Constructor Description TlsContextConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TlsContextConfigurationfromDropwizardTlsConfiguration(io.dropwizard.client.ssl.TlsConfiguration tlsConfig)Given a DropwizardTlsConfiguration, create a newTlsContextConfiguration.io.dropwizard.client.ssl.TlsConfigurationtoDropwizardTlsConfiguration()Convert thisTlsContextConfigurationinto a DropwizardTlsConfigurationobject.SSLContextConfigurationtoSslContextConfiguration()Convert this configuration into aSSLContextConfiguration.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.kiwiproject.security.KeyAndTrustStoreConfigProvider
getKeyStorePassword, getKeyStorePath, getKeyStoreType, toSSLContext
-
Methods inherited from interface org.kiwiproject.security.TrustStoreConfigProvider
getProtocol, getTrustStorePassword, getTrustStorePath, getTrustStoreType, isVerifyHostname, toSslSocketFactory
-
-
-
-
Method Detail
-
fromDropwizardTlsConfiguration
public static TlsContextConfiguration fromDropwizardTlsConfiguration(io.dropwizard.client.ssl.TlsConfiguration tlsConfig)
Given a DropwizardTlsConfiguration, create a newTlsContextConfiguration.Even though
TlsContextConfigurationdoes not permit null trust store properties (per the validation annotations), theTlsConfigurationdoes. If we encounter this sitation, we will be lenient; even though this could possibly cause downstream problems, we will jsut assume the caller knows what it is doing.- Parameters:
tlsConfig- the Dropwizard TlsConfiguration from which to pull information- Returns:
- a new TlsContextConfiguration instance
- Implementation Note:
- Currently we do not support
supportedCiphersorcertAlias, which Dropwizard does.
-
toDropwizardTlsConfiguration
public io.dropwizard.client.ssl.TlsConfiguration toDropwizardTlsConfiguration()
Convert thisTlsContextConfigurationinto a DropwizardTlsConfigurationobject. Assumes that this object is valid.- Returns:
- a new Dropwizard TlsConfiguration instance
- Implementation Note:
- Requires dropwizard-client as a dependency
-
toSslContextConfiguration
public SSLContextConfiguration toSslContextConfiguration()
Convert this configuration into aSSLContextConfiguration.Note that the conversion is "lossy" since
SSLContextConfigurationdoes not currently have a separatetrustStoreTypeproperty. As a result the key store type in this instance is used to set thekeyStoreTypeon the returned instance, which is used as both the key and trust store type. Usually this won't be an issue, as (at least in our experience) people normally use the same type of key and trust stores.The
SSLContextConfigurationalso does not havesupportedProtocols, so that information is lost in the conversion.- Returns:
- the new SSLContextConfiguration instance
-
-