Class LdapConnectionConfig
java.lang.Object
org.apache.directory.ldap.client.api.LdapConnectionConfig
A class to hold the configuration for creating an LdapConnection.
- Author:
- Apache Directory Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default host : localhoststatic final intDefault ports for LDAPstatic final intDefault port for LDAPSstatic final Stringthe default protocol used for creating SSL contextstatic final longThe default timeout for operation : 30 secondsstatic final intThe LDAP version -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.directory.api.ldap.codec.api.BinaryAttributeDetectorGet the BinaryAttribute detector instanceGets close timeout in milliseconds.Gets connect timeout in milliseconds.Gets the credentials.Gets the default LDAP host.intGets the default LDAP port.intGets the default LDAPS port.longGets the default timeout in milliseconds.String[]Gets the cipher suites which are enabled.String[]Gets the protocols which are enabled.Gets the key managers.org.apache.directory.api.ldap.codec.api.LdapApiServiceGet the the LdapApiService instanceGets the LDAP host.intGets the LDAP port.getName()Gets the name that is used to authenticate the user.Gets read operation timeout in milliseconds.Gets the secure random.Gets send timeout in milliseconds.Gets the endpoint identification algorithm used for hostname verification during TLS handshake.Gets the SSL protocol.intGets the supported LDAP version.longGets the timeout in milliseconds.Gets the trust managers.Gets write operation timeout in milliseconds.booleanisUseSsl()Checks if SSL (ldaps://) is used.booleanisUseTls()Checks if TLS is used.voidsetBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetector) Set the BinaryAttribute detector instancevoidsetCloseTimeout(Long timeout) Sets close timeout in milliseconds.voidsetConnectTimeout(Long timeout) Sets connect timeout in milliseconds.voidsetCredentials(String credentials) Sets the credentials.voidsetEnabledCipherSuites(String[] enabledCipherSuites) Sets the cipher suites which are enabledvoidsetEnabledProtocols(String... enabledProtocols) Sets the protocols which are enabledvoidsetKeyManagers(KeyManager[] keyManagers) Sets the key managers.voidsetLdapApiService(org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Set the LdapApiService instancevoidsetLdapHost(String ldapHost) Sets the LDAP host.voidsetLdapPort(int ldapPort) Sets the LDAP port.voidSets the name which is used to authenticate the user.voidsetReadOperationTimeout(Long timeout) Sets read operation timeout in milliseconds.voidsetSecureRandom(SecureRandom secureRandom) Sets the secure random.voidsetSendTimeout(Long timeout) Sets the send timeout in milliseconds.voidsetSslEndpointIdentificationAlgorithm(String sslEndpointIdentificationAlgorithm) Sets the endpoint identification algorithm used for hostname verification during TLS handshake.voidsetSslProtocol(String sslProtocol) Sets the SSL protocol.voidsetTimeout(long timeout) Sets the timeout in milliseconds.voidsetTrustManagers(TrustManager... trustManagers) Sets the trust managers.voidsetUseSsl(boolean useSsl) Sets whether SSL should be used.voidsetUseTls(boolean useTls) Sets whether TLS should be used.voidsetWriteOperationTimeout(Long timeout) Sets write operation timeout in milliseconds.
-
Field Details
-
DEFAULT_LDAP_PORT
public static final int DEFAULT_LDAP_PORTDefault ports for LDAP- See Also:
-
DEFAULT_LDAPS_PORT
public static final int DEFAULT_LDAPS_PORTDefault port for LDAPS- See Also:
-
DEFAULT_LDAP_HOST
-
LDAP_V3
public static final int LDAP_V3The LDAP version- See Also:
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUTThe default timeout for operation : 30 seconds- See Also:
-
DEFAULT_SSL_PROTOCOL
the default protocol used for creating SSL context- See Also:
-
-
Constructor Details
-
LdapConnectionConfig
public LdapConnectionConfig()Creates a default LdapConnectionConfig instance
-
-
Method Details
-
isUseSsl
public boolean isUseSsl()Checks if SSL (ldaps://) is used.- Returns:
- true, if SSL is used
-
setUseSsl
public void setUseSsl(boolean useSsl) Sets whether SSL should be used.- Parameters:
useSsl- true to use SSL
-
getLdapPort
public int getLdapPort()Gets the LDAP port.- Returns:
- the LDAP port
-
setLdapPort
public void setLdapPort(int ldapPort) Sets the LDAP port.- Parameters:
ldapPort- the new LDAP port
-
getLdapHost
-
setLdapHost
Sets the LDAP host.- Parameters:
ldapHost- the new LDAP host
-
getName
-
setName
Sets the name which is used to authenticate the user.- Parameters:
name- the new name
-
getCredentials
-
setCredentials
Sets the credentials.- Parameters:
credentials- the new credentials
-
getDefaultLdapPort
public int getDefaultLdapPort()Gets the default LDAP port.- Returns:
- the default LDAP port
-
getDefaultLdapsPort
public int getDefaultLdapsPort()Gets the default LDAPS port.- Returns:
- the default LDAPS port
-
getDefaultLdapHost
-
getDefaultTimeout
public long getDefaultTimeout()Gets the default timeout in milliseconds.- Returns:
- the default timeout in milliseconds
-
getTimeout
public long getTimeout()Gets the timeout in milliseconds. This is a "global" timeout. It is used when operation-specific timeouts are not specified. It is also used for extended operations.- Returns:
- the timeout in milliseconds
-
setTimeout
public void setTimeout(long timeout) Sets the timeout in milliseconds. This is a "global" timeout. It is used when operation-specific timeouts are not specified. It is also used for extended operations.- Parameters:
timeout- the timeout in milliseconds to set. If < 0, will be set to infinite
-
getConnectTimeout
Gets connect timeout in milliseconds. Connect timeout is applied to connect and bind operations. If not specified, global timeout setting is applied.- Returns:
- the timeout in milliseconds
-
setConnectTimeout
Sets connect timeout in milliseconds. Connect timeout is applied to connect and bind operations. If not specified, global timeout setting is applied.- Parameters:
timeout- the timeout in milliseconds to set. If < 0, will be set to infinite
-
getWriteOperationTimeout
Gets write operation timeout in milliseconds. Write operation timeout is applied to operations that write data, such as add, modify and delete. If not specified, global timeout setting is applied.- Returns:
- the timeout in milliseconds
-
setWriteOperationTimeout
Sets write operation timeout in milliseconds. Write operation timeout is applied to operations that write data, such as add, modify and delete. If not specified, global timeout setting is applied.- Parameters:
timeout- the timeout in milliseconds to set. If < 0, will be set to infinite
-
getReadOperationTimeout
Gets read operation timeout in milliseconds. This timeout is applied to read operations, such as search and compare. If not specified, global timeout setting is applied.- Returns:
- the timeout in milliseconds
-
setReadOperationTimeout
Sets read operation timeout in milliseconds. This timeout is applied to read operations, such as search and compare. If not specified, global timeout setting is applied.- Parameters:
timeout- the timeout in milliseconds to set. If < 0, will be set to infinite
-
getCloseTimeout
Gets close timeout in milliseconds. Close timeout is applied to close and unbind operations. If not specified, global timeout setting is applied.- Returns:
- the timeout in milliseconds
-
setCloseTimeout
Sets close timeout in milliseconds. Close timeout is applied to close and unbind operations. If not specified, global timeout setting is applied.- Parameters:
timeout- the timeout in milliseconds to set. If < 0, will be set to infinite
-
getSendTimeout
Gets send timeout in milliseconds. Send timeout is used for I/O (TCP) write operations. If not specified, global timeout setting is applied.- Returns:
- the timeout in milliseconds
-
setSendTimeout
Sets the send timeout in milliseconds. Send timeout is used for I/O (TCP) write operations. If not specified, global timeout setting is applied.- Parameters:
timeout- the timeout in milliseconds to set. If < 0, will be set to infinite
-
getSupportedLdapVersion
public int getSupportedLdapVersion()Gets the supported LDAP version.- Returns:
- the supported LDAP version
-
getTrustManagers
-
setTrustManagers
Sets the trust managers.- Parameters:
trustManagers- the new trust managers- Throws:
IllegalArgumentException- if the trustManagers parameter is null or empty
-
getSslProtocol
-
setSslProtocol
Sets the SSL protocol.- Parameters:
sslProtocol- the new SSL protocol
-
getSslEndpointIdentificationAlgorithm
Gets the endpoint identification algorithm used for hostname verification during TLS handshake. The default value is "LDAPS" as specified by RFC 4513. Set to null to disable hostname verification (not recommended).- Returns:
- the endpoint identification algorithm
-
setSslEndpointIdentificationAlgorithm
Sets the endpoint identification algorithm used for hostname verification during TLS handshake. The default value is "LDAPS" as specified by RFC 4513. Set to null to disable hostname verification (not recommended).- Parameters:
sslEndpointIdentificationAlgorithm- the endpoint identification algorithm
-
getKeyManagers
-
setKeyManagers
Sets the key managers.- Parameters:
keyManagers- the new key managers
-
getSecureRandom
-
setSecureRandom
Sets the secure random.- Parameters:
secureRandom- the new secure random
-
getEnabledCipherSuites
Gets the cipher suites which are enabled.- Returns:
- the cipher suites which are enabled
-
setEnabledCipherSuites
Sets the cipher suites which are enabled- Parameters:
enabledCipherSuites- the cipher suites which are enabled
-
getEnabledProtocols
Gets the protocols which are enabled.- Returns:
- the protocol which are enabled
-
setEnabledProtocols
Sets the protocols which are enabled- Parameters:
enabledProtocols- the protocols which are enabled
-
getBinaryAttributeDetector
public org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector getBinaryAttributeDetector()Get the BinaryAttribute detector instance- Returns:
- the binaryAttributeDetector
-
setBinaryAttributeDetector
public void setBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetector) Set the BinaryAttribute detector instance- Parameters:
binaryAttributeDetector- the binaryAttributeDetector to set
-
isUseTls
public boolean isUseTls()Checks if TLS is used.- Returns:
- true, if TLS is used
-
setUseTls
public void setUseTls(boolean useTls) Sets whether TLS should be used.- Parameters:
useTls- true to use TLS
-
getLdapApiService
public org.apache.directory.api.ldap.codec.api.LdapApiService getLdapApiService()Get the the LdapApiService instance- Returns:
- the ldapApiService
-
setLdapApiService
public void setLdapApiService(org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Set the LdapApiService instance- Parameters:
ldapApiService- the ldapApiService to set
-