Package org.ldaptive.ssl
Class SslConfig
- java.lang.Object
-
- org.ldaptive.AbstractConfig
-
- org.ldaptive.ssl.SslConfig
-
public class SslConfig extends AbstractConfig
Contains all the configuration data for SSL and startTLS.- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSslConfig.Builder
-
Field Summary
-
Fields inherited from class org.ldaptive.AbstractConfig
logger
-
-
Constructor Summary
Constructors Constructor Description SslConfig()Default constructor.SslConfig(javax.net.ssl.TrustManager... managers)Creates a new ssl config.SslConfig(CredentialConfig config)Creates a new ssl config.SslConfig(CredentialConfig config, javax.net.ssl.TrustManager... managers)Creates a new ssl config.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SslConfig.Builderbuilder()Creates a builder for this class.static SslConfigcopy(SslConfig config)Returns a ssl config initialized with the supplied config.SSLContextInitializercreateSSLContextInitializer()Creates anSSLContextInitializerfrom this configuration.CredentialConfiggetCredentialConfig()Returns the credential config.java.lang.String[]getEnabledCipherSuites()Returns the names of the SSL cipher suites to use for secure connections.java.lang.String[]getEnabledProtocols()Returns the names of the SSL protocols to use for secure connections.javax.net.ssl.HandshakeCompletedListener[]getHandshakeCompletedListeners()Returns the handshake completed listeners to use for secure connections.java.time.DurationgetHandshakeTimeout()Returns the handshake timeout.CertificateHostnameVerifiergetHostnameVerifier()Returns the hostname verifier.javax.net.ssl.TrustManager[]getTrustManagers()Returns the trust managers.booleanisEmpty()Returns whether this ssl config contains any configuration data.voidsetCredentialConfig(CredentialConfig config)Sets the credential config.voidsetEnabledCipherSuites(java.lang.String... suites)Sets the SSL cipher suites to use for secure connections.voidsetEnabledProtocols(java.lang.String... protocols)Sets the SSL protocol versions to use for secure connections.voidsetHandshakeCompletedListeners(javax.net.ssl.HandshakeCompletedListener... listeners)Sets the handshake completed listeners to use for secure connections.voidsetHandshakeTimeout(java.time.Duration time)Sets the maximum amount of time that handshakes will block.voidsetHostnameVerifier(CertificateHostnameVerifier verifier)Sets the hostname verifier.voidsetTrustManagers(javax.net.ssl.TrustManager... managers)Sets the trust managers.java.lang.StringtoString()-
Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkImmutable, checkStringInput, makeImmutable
-
-
-
-
Constructor Detail
-
SslConfig
public SslConfig()
Default constructor.
-
SslConfig
public SslConfig(CredentialConfig config)
Creates a new ssl config.- Parameters:
config- credential config
-
SslConfig
public SslConfig(javax.net.ssl.TrustManager... managers)
Creates a new ssl config.- Parameters:
managers- trust managers
-
SslConfig
public SslConfig(CredentialConfig config, javax.net.ssl.TrustManager... managers)
Creates a new ssl config.- Parameters:
config- credential configmanagers- trust managers
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Returns whether this ssl config contains any configuration data.- Returns:
- whether all properties are null
-
getCredentialConfig
public CredentialConfig getCredentialConfig()
Returns the credential config.- Returns:
- credential config
-
setCredentialConfig
public void setCredentialConfig(CredentialConfig config)
Sets the credential config.- Parameters:
config- credential config
-
getTrustManagers
public javax.net.ssl.TrustManager[] getTrustManagers()
Returns the trust managers.- Returns:
- trust managers
-
setTrustManagers
public void setTrustManagers(javax.net.ssl.TrustManager... managers)
Sets the trust managers.- Parameters:
managers- trust managers
-
getHostnameVerifier
public CertificateHostnameVerifier getHostnameVerifier()
Returns the hostname verifier.- Returns:
- hostname verifier
-
setHostnameVerifier
public void setHostnameVerifier(CertificateHostnameVerifier verifier)
Sets the hostname verifier.- Parameters:
verifier- hostname verifier
-
getEnabledCipherSuites
public java.lang.String[] getEnabledCipherSuites()
Returns the names of the SSL cipher suites to use for secure connections.- Returns:
- cipher suites
-
setEnabledCipherSuites
public void setEnabledCipherSuites(java.lang.String... suites)
Sets the SSL cipher suites to use for secure connections.- Parameters:
suites- cipher suites
-
getEnabledProtocols
public java.lang.String[] getEnabledProtocols()
Returns the names of the SSL protocols to use for secure connections.- Returns:
- enabled protocols
-
setEnabledProtocols
public void setEnabledProtocols(java.lang.String... protocols)
Sets the SSL protocol versions to use for secure connections.- Parameters:
protocols- enabled protocols
-
getHandshakeCompletedListeners
public javax.net.ssl.HandshakeCompletedListener[] getHandshakeCompletedListeners()
Returns the handshake completed listeners to use for secure connections.- Returns:
- handshake completed listeners
-
setHandshakeCompletedListeners
public void setHandshakeCompletedListeners(javax.net.ssl.HandshakeCompletedListener... listeners)
Sets the handshake completed listeners to use for secure connections.- Parameters:
listeners- for SSL handshake events
-
getHandshakeTimeout
public java.time.Duration getHandshakeTimeout()
Returns the handshake timeout.- Returns:
- timeout
-
setHandshakeTimeout
public void setHandshakeTimeout(java.time.Duration time)
Sets the maximum amount of time that handshakes will block.- Parameters:
time- timeout for handshakes
-
copy
public static SslConfig copy(SslConfig config)
Returns a ssl config initialized with the supplied config.- Parameters:
config- ssl config to read properties from- Returns:
- ssl config
-
createSSLContextInitializer
public SSLContextInitializer createSSLContextInitializer() throws java.security.GeneralSecurityException
Creates anSSLContextInitializerfrom this configuration. If aCredentialConfigis provided it is used, otherwise aDefaultSSLContextInitializeris created.- Returns:
- SSL context initializer
- Throws:
java.security.GeneralSecurityException- if the SSL context initializer cannot be created
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
builder
public static SslConfig.Builder builder()
Creates a builder for this class.- Returns:
- new builder
-
-