Package org.ldaptive.ssl
Class SslConfig
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.AbstractConfig
org.ldaptive.ssl.SslConfig
- All Implemented Interfaces:
Freezable
Contains all the configuration data for SSL and startTLS.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CredentialConfigConfiguration 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 DurationDuration of time that handshakes will block.private CertificateHostnameVerifierCertificate 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.Builderbuilder()Creates a builder for this class.static SslConfigReturns a ssl config initialized with the supplied config.Creates anSSLContextInitializerfrom this configuration.voidfreeze()Freezes this object, making it immutable.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.booleanisEmpty()Returns whether this ssl config contains any configuration data.voidsetCredentialConfig(CredentialConfig config) Sets the credential config.voidsetEnabledCipherSuites(String... suites) Sets the SSL cipher suites to use for secure connections.voidsetEnabledProtocols(String... protocols) Sets the SSL protocol versions to use for secure connections.voidsetHandshakeCompletedListeners(HandshakeCompletedListener... listeners) Sets the handshake completed listeners to use for secure connections.voidsetHandshakeTimeout(Duration time) Sets the maximum amount of time that handshakes will block.voidSets the hostname verifier.voidsetTrustManagers(TrustManager... managers) Sets the trust managers.toString()Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkStringInputMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
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
-
freeze
public void freeze()Description copied from interface:FreezableFreezes this object, making it immutable.- Specified by:
freezein interfaceFreezable- Overrides:
freezein classAbstractFreezable
-
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 anSSLContextInitializerfrom this configuration. If aCredentialConfigis provided it is used, otherwise aDefaultSSLContextInitializeris 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
-