Class LdapConnectionConfig
- java.lang.Object
-
- org.apache.directory.ldap.client.api.LdapConnectionConfig
-
public class LdapConnectionConfig extends Object
A class to hold the configuration for creating an LdapConnection.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_LDAP_HOST
The default host : localhoststatic int
DEFAULT_LDAP_PORT
Default ports for LDAPstatic int
DEFAULT_LDAPS_PORT
Default port for LDAPSstatic String
DEFAULT_SSL_PROTOCOL
the default protocol used for creating SSL contextstatic long
DEFAULT_TIMEOUT
The default timeout for operation : 30 secondsstatic int
LDAP_V3
The LDAP version
-
Constructor Summary
Constructors Constructor Description LdapConnectionConfig()
Creates a default LdapConnectionConfig instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BinaryAttributeDetector
getBinaryAttributeDetector()
Long
getCloseTimeout()
Gets close timeout in milliseconds.Long
getConnectTimeout()
Gets connect timeout in milliseconds.String
getCredentials()
Gets the credentials.String
getDefaultLdapHost()
Gets the default LDAP host.int
getDefaultLdapPort()
Gets the default LDAP port.int
getDefaultLdapsPort()
Gets the default LDAPS port.long
getDefaultTimeout()
Gets the default timeout in milliseconds.String[]
getEnabledCipherSuites()
Gets the cipher suites which are enabled.String[]
getEnabledProtocols()
Gets the protocols which are enabled.KeyManager[]
getKeyManagers()
Gets the key managers.LdapApiService
getLdapApiService()
String
getLdapHost()
Gets the LDAP host.int
getLdapPort()
Gets the LDAP port.String
getName()
Gets the name that is used to authenticate the user.Long
getReadOperationTimeout()
Gets read operation timeout in milliseconds.SecureRandom
getSecureRandom()
Gets the secure random.Long
getSendTimeout()
Gets send timeout in milliseconds.String
getSslProtocol()
Gets the SSL protocol.int
getSupportedLdapVersion()
Gets the supported LDAP version.long
getTimeout()
Gets the timeout in milliseconds.TrustManager[]
getTrustManagers()
Gets the trust managers.Long
getWriteOperationTimeout()
Gets write operation timeout in milliseconds.boolean
isUseSsl()
Checks if SSL (ldaps://) is used.boolean
isUseTls()
Checks if TLS is used.void
setBinaryAttributeDetector(BinaryAttributeDetector binaryAttributeDetector)
void
setCloseTimeout(Long timeout)
Sets close timeout in milliseconds.void
setConnectTimeout(Long timeout)
Sets connect timeout in milliseconds.void
setCredentials(String credentials)
Sets the credentials.void
setEnabledCipherSuites(String[] enabledCipherSuites)
Sets the cipher suites which are enabledvoid
setEnabledProtocols(String... enabledProtocols)
Sets the protocols which are enabledvoid
setKeyManagers(KeyManager[] keyManagers)
Sets the key managers.void
setLdapApiService(LdapApiService ldapApiService)
void
setLdapHost(String ldapHost)
Sets the LDAP host.void
setLdapPort(int ldapPort)
Sets the LDAP port.void
setName(String name)
Sets the name which is used to authenticate the user.void
setReadOperationTimeout(Long timeout)
Sets read operation timeout in milliseconds.void
setSecureRandom(SecureRandom secureRandom)
Sets the secure random.void
setSendTimeout(Long timeout)
Sets the send timeout in milliseconds.void
setSslProtocol(String sslProtocol)
Sets the SSL protocol.void
setTimeout(long timeout)
Sets the timeout in milliseconds.void
setTrustManagers(TrustManager... trustManagers)
Sets the trust managers.void
setUseSsl(boolean useSsl)
Sets whether SSL should be used.void
setUseTls(boolean useTls)
Sets whether TLS should be used.void
setWriteOperationTimeout(Long timeout)
Sets write operation timeout in milliseconds.
-
-
-
Field Detail
-
DEFAULT_LDAP_PORT
public static final int DEFAULT_LDAP_PORT
Default ports for LDAP- See Also:
- Constant Field Values
-
DEFAULT_LDAPS_PORT
public static final int DEFAULT_LDAPS_PORT
Default port for LDAPS- See Also:
- Constant Field Values
-
DEFAULT_LDAP_HOST
public static final String DEFAULT_LDAP_HOST
The default host : localhost- See Also:
- Constant Field Values
-
LDAP_V3
public static final int LDAP_V3
The LDAP version- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT
The default timeout for operation : 30 seconds- See Also:
- Constant Field Values
-
DEFAULT_SSL_PROTOCOL
public static final String DEFAULT_SSL_PROTOCOL
the default protocol used for creating SSL context- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LdapConnectionConfig
public LdapConnectionConfig()
Creates a default LdapConnectionConfig instance
-
-
Method Detail
-
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
public String getLdapHost()
Gets the LDAP host.- Returns:
- the LDAP host
-
setLdapHost
public void setLdapHost(String ldapHost)
Sets the LDAP host.- Parameters:
ldapHost
- the new LDAP host
-
getName
public String getName()
Gets the name that is used to authenticate the user.- Returns:
- the name
-
setName
public void setName(String name)
Sets the name which is used to authenticate the user.- Parameters:
name
- the new name
-
getCredentials
public String getCredentials()
Gets the credentials.- Returns:
- the credentials
-
setCredentials
public void setCredentials(String credentials)
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
public String getDefaultLdapHost()
Gets the default LDAP host.- Returns:
- the default LDAP host
-
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
public Long 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
public void setConnectTimeout(Long timeout)
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
public Long 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
public void setWriteOperationTimeout(Long timeout)
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
public Long 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
public void setReadOperationTimeout(Long timeout)
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
public Long 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
public void setCloseTimeout(Long timeout)
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
public Long 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
public void setSendTimeout(Long timeout)
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
public TrustManager[] getTrustManagers()
Gets the trust managers.- Returns:
- the trust managers
-
setTrustManagers
public void setTrustManagers(TrustManager... trustManagers)
Sets the trust managers.- Parameters:
trustManagers
- the new trust managers- Throws:
IllegalArgumentException
- if the trustManagers parameter is null or empty
-
getSslProtocol
public String getSslProtocol()
Gets the SSL protocol.- Returns:
- the SSL protocol
-
setSslProtocol
public void setSslProtocol(String sslProtocol)
Sets the SSL protocol.- Parameters:
sslProtocol
- the new SSL protocol
-
getKeyManagers
public KeyManager[] getKeyManagers()
Gets the key managers.- Returns:
- the key managers
-
setKeyManagers
public void setKeyManagers(KeyManager[] keyManagers)
Sets the key managers.- Parameters:
keyManagers
- the new key managers
-
getSecureRandom
public SecureRandom getSecureRandom()
Gets the secure random.- Returns:
- the secure random
-
setSecureRandom
public void setSecureRandom(SecureRandom secureRandom)
Sets the secure random.- Parameters:
secureRandom
- the new secure random
-
getEnabledCipherSuites
public String[] getEnabledCipherSuites()
Gets the cipher suites which are enabled.- Returns:
- the cipher suites which are enabled
-
setEnabledCipherSuites
public void setEnabledCipherSuites(String[] enabledCipherSuites)
Sets the cipher suites which are enabled- Parameters:
enabledCipherSuites
- the cipher suites which are enabled
-
getEnabledProtocols
public String[] getEnabledProtocols()
Gets the protocols which are enabled.- Returns:
- the protocol which are enabled
-
setEnabledProtocols
public void setEnabledProtocols(String... enabledProtocols)
Sets the protocols which are enabled- Parameters:
enabledProtocols
- the protocols which are enabled
-
getBinaryAttributeDetector
public BinaryAttributeDetector getBinaryAttributeDetector()
- Returns:
- the binaryAttributeDetector
-
setBinaryAttributeDetector
public void setBinaryAttributeDetector(BinaryAttributeDetector binaryAttributeDetector)
- 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 LdapApiService getLdapApiService()
- Returns:
- the ldapApiService
-
setLdapApiService
public void setLdapApiService(LdapApiService ldapApiService)
- Parameters:
ldapApiService
- the ldapApiService to set
-
-