Package org.ldaptive.ssl
Class SslConfig
java.lang.Object
org.ldaptive.AbstractConfig
org.ldaptive.ssl.SslConfig
Contains all the configuration data for SSL and startTLS.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CredentialConfig
Configuration for the trust and authentication material to use for SSL and startTLS.private String[]
Enabled cipher suites.private String[]
Enabled protocol versions.private HandshakeCompletedListener[]
Handshake completed listeners.private Duration
Duration of time that handshakes will block.private CertificateHostnameVerifier
Certificate hostname verifier.private TrustManager[]
Trust managers.Fields inherited from class org.ldaptive.AbstractConfig
logger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SslConfig
(TrustManager... managers) Creates a new ssl config.SslConfig
(CredentialConfig config) Creates a new ssl config.SslConfig
(CredentialConfig config, TrustManager... managers) Creates a new ssl config. -
Method Summary
Modifier and TypeMethodDescriptionstatic SslConfig.Builder
builder()
Creates a builder for this class.static SslConfig
Returns a ssl config initialized with the supplied config.Creates anSSLContextInitializer
from this configuration.Returns the credential config.String[]
Returns the names of the SSL cipher suites to use for secure connections.String[]
Returns the names of the SSL protocols to use for secure connections.Returns the handshake completed listeners to use for secure connections.Returns the handshake timeout.Returns the hostname verifier.Returns the trust managers.boolean
isEmpty()
Returns whether this ssl config contains any configuration data.void
setCredentialConfig
(CredentialConfig config) Sets the credential config.void
setEnabledCipherSuites
(String... suites) Sets the SSL cipher suites to use for secure connections.void
setEnabledProtocols
(String... protocols) Sets the SSL protocol versions to use for secure connections.void
setHandshakeCompletedListeners
(HandshakeCompletedListener... listeners) Sets the handshake completed listeners to use for secure connections.void
setHandshakeTimeout
(Duration time) Sets the maximum amount of time that handshakes will block.void
Sets the hostname verifier.void
setTrustManagers
(TrustManager... managers) Sets the trust managers.toString()
Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkImmutable, checkStringInput, makeImmutable
-
Field Details
-
credentialConfig
Configuration for the trust and authentication material to use for SSL and startTLS. -
trustManagers
Trust managers. -
hostnameVerifier
Certificate hostname verifier. -
enabledCipherSuites
Enabled cipher suites. -
enabledProtocols
Enabled protocol versions. -
handshakeCompletedListeners
Handshake completed listeners. -
handshakeTimeout
Duration of time that handshakes will block.
-
-
Constructor Details
-
SslConfig
public SslConfig()Default constructor. -
SslConfig
Creates a new ssl config.- Parameters:
config
- credential config
-
SslConfig
Creates a new ssl config.- Parameters:
managers
- trust managers
-
SslConfig
Creates a new ssl config.- Parameters:
config
- credential configmanagers
- trust managers
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returns whether this ssl config contains any configuration data.- Returns:
- whether all properties are null
-
getCredentialConfig
Returns the credential config.- Returns:
- credential config
-
setCredentialConfig
Sets the credential config.- Parameters:
config
- credential config
-
getTrustManagers
Returns the trust managers.- Returns:
- trust managers
-
setTrustManagers
Sets the trust managers.- Parameters:
managers
- trust managers
-
getHostnameVerifier
Returns the hostname verifier.- Returns:
- hostname verifier
-
setHostnameVerifier
Sets the hostname verifier.- Parameters:
verifier
- hostname verifier
-
getEnabledCipherSuites
Returns the names of the SSL cipher suites to use for secure connections.- Returns:
- cipher suites
-
setEnabledCipherSuites
Sets the SSL cipher suites to use for secure connections.- Parameters:
suites
- cipher suites
-
getEnabledProtocols
Returns the names of the SSL protocols to use for secure connections.- Returns:
- enabled protocols
-
setEnabledProtocols
Sets the SSL protocol versions to use for secure connections.- Parameters:
protocols
- enabled protocols
-
getHandshakeCompletedListeners
Returns the handshake completed listeners to use for secure connections.- Returns:
- handshake completed listeners
-
setHandshakeCompletedListeners
Sets the handshake completed listeners to use for secure connections.- Parameters:
listeners
- for SSL handshake events
-
getHandshakeTimeout
Returns the handshake timeout.- Returns:
- timeout
-
setHandshakeTimeout
Sets the maximum amount of time that handshakes will block.- Parameters:
time
- timeout for handshakes
-
copy
Returns a ssl config initialized with the supplied config.- Parameters:
config
- ssl config to read properties from- Returns:
- ssl config
-
createSSLContextInitializer
Creates anSSLContextInitializer
from this configuration. If aCredentialConfig
is provided it is used, otherwise aDefaultSSLContextInitializer
is created.- Returns:
- SSL context initializer
- Throws:
GeneralSecurityException
- if the SSL context initializer cannot be created
-
toString
-
builder
Creates a builder for this class.- Returns:
- new builder
-