Package edu.vt.middleware.ldap
Class LdapConfig
- java.lang.Object
-
- edu.vt.middleware.ldap.props.AbstractPropertyConfig
-
- edu.vt.middleware.ldap.LdapConfig
-
- All Implemented Interfaces:
PropertyConfig
- Direct Known Subclasses:
AuthenticatorConfig
public class LdapConfig extends AbstractPropertyConfig
LdapConfig
contains all the configuration data that theLdap
needs to control connections and searching.- Version:
- $Revision: 1786 $ $Date: 2011-01-05 15:45:07 +0100 (Wed, 05 Jan 2011) $
- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LdapConfig.SearchScope
Enum to define the type of search scope.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTIES_DOMAIN
Domain to look for ldap properties in, value is "edu.vt.middleware.ldap.".-
Fields inherited from class edu.vt.middleware.ldap.props.AbstractPropertyConfig
logger
-
-
Constructor Summary
Constructors Constructor Description LdapConfig()
Default constructor.LdapConfig(java.lang.String ldapUrl)
This will create a newLdapConfig
with the supplied ldap url.LdapConfig(java.lang.String ldapUrl, java.lang.String baseDn)
This will create a newLdapConfig
with the supplied ldap url and base Strings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static LdapConfig
createFromProperties(java.io.InputStream is)
Create an instance of this class initialized with properties from the input stream.boolean
getAuthoritative()
SeeisAuthoritative()
.java.lang.String
getAuthtype()
This returns the security level for theLdapConfig
.java.lang.String
getBase()
Deprecated.usegetBaseDn()
insteadjava.lang.String
getBaseDn()
This returns the base dn for theLdapConfig
.int
getBatchSize()
This returns the batch size for theLdapConfig
.java.lang.String
getBinaryAttributes()
This returns additional binary attributes for theLdapConfig
.java.lang.Object
getBindCredential()
This returns the credential used with the bind DN.java.lang.String
getBindDn()
This returns the bind DN.static javax.naming.directory.SearchControls
getCompareSearchControls()
This returns aSearchControls
object configured to perform a LDAP compare operation.ConnectionHandler
getConnectionHandler()
This returns the connection handler of theLdapConfig
.java.lang.String
getContextFactory()
This returns the context factory of theLdapConfig
.long
getCountLimit()
This returns the count limit for theLdapConfig
.java.lang.String
getDerefAliases()
This returns the alias setting for theLdapConfig
.boolean
getDerefLinkFlag()
This returns the derefLinkFlag for theLdapConfig
.java.lang.String
getDnsUrl()
This returns the dns url for theLdapConfig
.java.util.Hashtable<java.lang.String,?>
getEnvironment()
This returns the Context environment properties that are used to make LDAP connections.java.util.Map<java.lang.String,java.lang.Object>
getEnvironmentProperties()
This returns any environment properties that may have been set for theLdapConfig
usingsetEnvironmentProperties(String,String)
that do not represent properties of this config.java.lang.Class<?>[]
getHandlerIgnoreExceptions()
This returns the exception types to ignore when handling results.java.lang.String
getHost()
Deprecated.usegetLdapUrl()
insteadjavax.net.ssl.HostnameVerifier
getHostnameVerifier()
This returns the hostname verifier of theLdapConfig
.java.lang.String
getLanguage()
This returns the preferred language for theLdapConfig
.java.lang.String
getLdapUrl()
This returns the ldap url of theLdapConfig
.boolean
getLogCredentials()
This returns whether authentication credentials will be logged.int
getOperationRetry()
This returns the number of times ldap operations will be retried if a communication exception occurs.int
getOperationRetryBackoff()
This returns the factor by which to multiply the operation retry wait time.java.lang.Class<?>[]
getOperationRetryExceptions()
This returns the exception types to retry operations on.long
getOperationRetryWait()
This returns the operation retry wait time for theLdapConfig
.int
getPagedResultsSize()
This returns the paged results size for theLdapConfig
.java.lang.String
getPort()
Deprecated.usegetLdapUrl()
insteadjava.lang.String
getPropertiesDomain()
This returns the properties domain for this property config.java.lang.String
getReferral()
This returns the referral setting for theLdapConfig
.boolean
getReturningObjFlag()
This returns the returningObjFlag for theLdapConfig
.java.lang.String
getSaslAuthorizationId()
This returns ths SASL authorization id for theLdapConfig
.java.lang.String
getSaslRealm()
This returns ths SASL realm for theLdapConfig
.javax.naming.directory.SearchControls
getSearchControls(java.lang.String[] retAttrs)
This returns aSearchControls
object configured with thisLdapConfig
.SearchResultHandler[]
getSearchResultHandlers()
This returns the handlers to use for processing search results.LdapConfig.SearchScope
getSearchScope()
This returns the search scope for theLdapConfig
.java.lang.Object
getServiceCredential()
Deprecated.usegetBindCredential()
insteadjava.lang.String
getServiceUser()
Deprecated.usegetBindDn()
insteadboolean
getSsl()
SeeisSslEnabled()
.javax.net.ssl.SSLSocketFactory
getSslSocketFactory()
This returns the SSL socket factory of theLdapConfig
.int
getTimeLimit()
This returns the time limit for theLdapConfig
.int
getTimeout()
This returns the timeout for theLdapConfig
.boolean
getTls()
SeeisTlsEnabled()
.boolean
getTypesOnly()
SeeisTypesOnly()
.boolean
hasEnvironmentProperty(java.lang.String name)
This returns whether the supplied property exists.boolean
isAnonymousAuth()
This returns whether the security authentication context is set to 'none'.boolean
isAuthoritative()
This returns whether theLdapConfig
is set to require a authoritative source.boolean
isCramMD5Auth()
This returns whether the security authentication context is set to 'CRAM-MD5'.boolean
isDigestMD5Auth()
This returns whether the security authentication context is set to 'DIGEST-MD5'.boolean
isExternalAuth()
This returns whether the security authentication context is set to 'EXTERNAL'.boolean
isGSSAPIAuth()
This returns whether the security authentication context is set to 'GSSAPI'.boolean
isObjectSearchScope()
This returns whether the search scope is set to object.boolean
isOneLevelSearchScope()
This returns whether the search scope is set to one level.boolean
isSaslAuth()
This returns whether the security authentication context will perform a SASL bind as defined by the supported SASL mechanisms.boolean
isSimpleAuth()
This returns whether the security authentication context is set to 'simple'.boolean
isSslEnabled()
This returns whether theLdapConfig
is using the SSL protocol for connections.boolean
isStrongAuth()
This returns whether the security authentication context is set to 'strong'.boolean
isSubTreeSearchScope()
This returns whether the search scope is set to sub tree.boolean
isTlsEnabled()
This returns whether theLdapConfig
is using the TLS protocol for connections.boolean
isTypesOnly()
This returns whether theLdapConfig
is set to only return attribute types.void
setAuthoritative(boolean authoritative)
This specifies whether or not to force thisLdapConfig
to require an authoritative source.void
setAuthtype(java.lang.String authtype)
This sets the security level for theLdapConfig
.void
setBase(java.lang.String base)
Deprecated.void
setBaseDn(java.lang.String baseDn)
This sets the base dn for theLdapConfig
.void
setBatchSize(int batchSize)
This sets the batch size for theLdapConfig
.void
setBinaryAttributes(java.lang.String binaryAttributes)
This specifies additional attributes that should be considered binary.void
setBindCredential(java.lang.Object credential)
This sets the credential of the bind DN.void
setBindDn(java.lang.String dn)
This sets the bind DN to authenticate as before performing operations.void
setConnectionHandler(ConnectionHandler connectionHandler)
This sets the connection handler of theLdapConfig
.void
setContextFactory(java.lang.String contextFactory)
This sets the context factory of theLdapConfig
.void
setCountLimit(long countLimit)
This sets the maximum number of entries that search operations will return.void
setDerefAliases(java.lang.String derefAliases)
This specifies how theLdapConfig
should handle aliases.void
setDerefLinkFlag(boolean derefLinkFlag)
This specifies whether or not to force thisLdapConfig
to link dereferencing during searches.void
setDnsUrl(java.lang.String dnsUrl)
This sets the dns url for theLdapConfig
.void
setEnvironmentProperties(java.lang.String name, java.lang.String value)
This adds environment properties to this object.void
setHandlerIgnoreExceptions(java.lang.Class<?>[] exceptions)
This sets the exception types to ignore when handling results.void
setHost(java.lang.String host)
Deprecated.usesetLdapUrl(String)
insteadvoid
setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
This sets the hostname verifier of theLdapConfig
.void
setLanguage(java.lang.String language)
This sets the preferred language for theLdapConfig
.void
setLdapUrl(java.lang.String ldapUrl)
This sets the ldap url of theLdapConfig
.void
setLogCredentials(boolean log)
This sets whether authentication credentials will be logged.void
setOperationRetry(int operationRetry)
This sets the number of times that ldap operations will be retried if a communication exception occurs.void
setOperationRetryBackoff(int backoff)
This sets the factor by which to multiply the operation retry wait time.void
setOperationRetryExceptions(java.lang.Class<?>[] exceptions)
This sets the exception types to retry operations on.void
setOperationRetryWait(long wait)
This sets the amount of time in milliseconds that operations should wait before retrying.void
setPagedResultsSize(int pageSize)
This sets the results size to use when the PagedResultsControl is invoked.void
setPort(java.lang.String port)
Deprecated.usesetLdapUrl(String)
insteadvoid
setReferral(java.lang.String referral)
This specifies how theLdapConfig
should handle referrals.void
setReturningObjFlag(boolean returningObjFlag)
This specifies whether or not to force thisLdapConfig
to return objects for searches.void
setSaslAuthorizationId(java.lang.String saslAuthorizationId)
This specifies a SASL authorization id.void
setSaslRealm(java.lang.String saslRealm)
This specifies a SASL realm.void
setSearchResultHandlers(SearchResultHandler[] handlers)
This sets the handlers for processing search results.void
setSearchScope(LdapConfig.SearchScope searchScope)
This sets the search scope for theLdapConfig
.void
setService(java.lang.String user, java.lang.Object credential)
Deprecated.usesetBindDn(String)
andsetBindCredential(Object)
insteadvoid
setServiceCredential(java.lang.Object credential)
Deprecated.usesetBindCredential(Object)
insteadvoid
setServiceUser(java.lang.String user)
Deprecated.usesetBindDn(String)
insteadvoid
setSsl(boolean ssl)
This sets thisLdapConfig
to use the SSL protocol for connections.void
setSslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
This sets the SSL socket factory of theLdapConfig
.void
setTimeLimit(int timeLimit)
This sets the maximum amount of time in milliseconds that search operations will block.void
setTimeout(int timeout)
This sets the maximum amount of time in milliseconds that connect operations will block.void
setTls(boolean tls)
This sets thisLdapConfig
to use the TLS protocol for connections.void
setTracePackets(java.io.PrintStream stream)
This sets thisLdapConfig
to print ASN.1 BER packets to the suppliedPrintStream
.void
setTypesOnly(boolean typesOnly)
This specifies whether or not to force thisLdapConfig
to return only attribute types.java.lang.String
toString()
Provides a descriptive string representation of this instance.boolean
useHostnameVerifier()
This returns whether theLdapConfig
is using a custom hostname verifier.boolean
useSslSocketFactory()
This returns whether theLdapConfig
is using a custom SSL socket factory.-
Methods inherited from class edu.vt.middleware.ldap.props.AbstractPropertyConfig
checkImmutable, checkStringInput, makeImmutable, setEnvironmentProperties, setEnvironmentProperties
-
-
-
-
Field Detail
-
PROPERTIES_DOMAIN
public static final java.lang.String PROPERTIES_DOMAIN
Domain to look for ldap properties in, value is "edu.vt.middleware.ldap.".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LdapConfig
public LdapConfig()
Default constructor.
-
LdapConfig
public LdapConfig(java.lang.String ldapUrl)
This will create a newLdapConfig
with the supplied ldap url.- Parameters:
ldapUrl
-String
LDAP URL
-
LdapConfig
public LdapConfig(java.lang.String ldapUrl, java.lang.String baseDn)
This will create a newLdapConfig
with the supplied ldap url and base Strings.- Parameters:
ldapUrl
-String
LDAP URLbaseDn
-String
LDAP base DN
-
-
Method Detail
-
getEnvironment
public java.util.Hashtable<java.lang.String,?> getEnvironment()
This returns the Context environment properties that are used to make LDAP connections.- Returns:
Hashtable
- context environment
-
getContextFactory
public java.lang.String getContextFactory()
This returns the context factory of theLdapConfig
.- Returns:
String
- context factory
-
getConnectionHandler
public ConnectionHandler getConnectionHandler()
This returns the connection handler of theLdapConfig
.- Returns:
ConnectionHandler
- connection handler
-
getSslSocketFactory
public javax.net.ssl.SSLSocketFactory getSslSocketFactory()
This returns the SSL socket factory of theLdapConfig
.- Returns:
SSLSocketFactory
- SSL socket factory
-
useSslSocketFactory
public boolean useSslSocketFactory()
This returns whether theLdapConfig
is using a custom SSL socket factory.- Returns:
boolean
-
getHostnameVerifier
public javax.net.ssl.HostnameVerifier getHostnameVerifier()
This returns the hostname verifier of theLdapConfig
.- Returns:
HostnameVerifier
- hostname verifier
-
useHostnameVerifier
public boolean useHostnameVerifier()
This returns whether theLdapConfig
is using a custom hostname verifier.- Returns:
boolean
-
getLdapUrl
public java.lang.String getLdapUrl()
This returns the ldap url of theLdapConfig
.- Returns:
String
- ldap url
-
getHost
@Deprecated public java.lang.String getHost()
Deprecated.usegetLdapUrl()
insteadThis returns the hostname of theLdapConfig
.- Returns:
String
- hostname
-
getPort
@Deprecated public java.lang.String getPort()
Deprecated.usegetLdapUrl()
insteadThis returns the port of theLdapConfig
.- Returns:
String
- port
-
getTimeout
public int getTimeout()
This returns the timeout for theLdapConfig
. If this value is 0, then connect operations will wait indefinitely.- Returns:
int
- timeout
-
getBindDn
public java.lang.String getBindDn()
This returns the bind DN.- Returns:
String
- DN to bind as
-
getServiceUser
@Deprecated public java.lang.String getServiceUser()
Deprecated.usegetBindDn()
insteadThis returns the username of the service user.- Returns:
String
- username
-
getBindCredential
public java.lang.Object getBindCredential()
This returns the credential used with the bind DN.- Returns:
Object
- bind DN credential
-
getServiceCredential
@Deprecated public java.lang.Object getServiceCredential()
Deprecated.usegetBindCredential()
insteadThis returns the credential of the service user.- Returns:
Object
- credential
-
getBase
public java.lang.String getBase()
Deprecated.usegetBaseDn()
insteadThis returns the base dn for theLdapConfig
.- Returns:
String
- base dn
-
getBaseDn
public java.lang.String getBaseDn()
This returns the base dn for theLdapConfig
.- Returns:
String
- base dn
-
getSearchScope
public LdapConfig.SearchScope getSearchScope()
This returns the search scope for theLdapConfig
.- Returns:
SearchScope
- search scope
-
isObjectSearchScope
public boolean isObjectSearchScope()
This returns whether the search scope is set to object.- Returns:
boolean
-
isOneLevelSearchScope
public boolean isOneLevelSearchScope()
This returns whether the search scope is set to one level.- Returns:
boolean
-
isSubTreeSearchScope
public boolean isSubTreeSearchScope()
This returns whether the search scope is set to sub tree.- Returns:
boolean
-
getAuthtype
public java.lang.String getAuthtype()
This returns the security level for theLdapConfig
.- Returns:
String
- security level
-
isAnonymousAuth
public boolean isAnonymousAuth()
This returns whether the security authentication context is set to 'none'.- Returns:
boolean
-
isSimpleAuth
public boolean isSimpleAuth()
This returns whether the security authentication context is set to 'simple'.- Returns:
boolean
-
isStrongAuth
public boolean isStrongAuth()
This returns whether the security authentication context is set to 'strong'.- Returns:
boolean
-
isSaslAuth
public boolean isSaslAuth()
This returns whether the security authentication context will perform a SASL bind as defined by the supported SASL mechanisms.- Returns:
boolean
-
isExternalAuth
public boolean isExternalAuth()
This returns whether the security authentication context is set to 'EXTERNAL'.- Returns:
boolean
-
isDigestMD5Auth
public boolean isDigestMD5Auth()
This returns whether the security authentication context is set to 'DIGEST-MD5'.- Returns:
boolean
-
isCramMD5Auth
public boolean isCramMD5Auth()
This returns whether the security authentication context is set to 'CRAM-MD5'.- Returns:
boolean
-
isGSSAPIAuth
public boolean isGSSAPIAuth()
This returns whether the security authentication context is set to 'GSSAPI'.- Returns:
boolean
-
getAuthoritative
public boolean getAuthoritative()
SeeisAuthoritative()
.- Returns:
boolean
-
isAuthoritative
public boolean isAuthoritative()
This returns whether theLdapConfig
is set to require a authoritative source.- Returns:
boolean
-
getTimeLimit
public int getTimeLimit()
This returns the time limit for theLdapConfig
. If this value is 0, then search operations will wait indefinitely for an answer.- Returns:
int
- time limit
-
getCountLimit
public long getCountLimit()
This returns the count limit for theLdapConfig
. If this value is 0, then search operations will return all the results it finds.- Returns:
long
- count limit
-
getPagedResultsSize
public int getPagedResultsSize()
This returns the paged results size for theLdapConfig
. This value is used whenever the PagedResultsControl in invoked.- Returns:
int
- page size
-
getOperationRetry
public int getOperationRetry()
This returns the number of times ldap operations will be retried if a communication exception occurs. If this value is 0, no retries will occur.- Returns:
int
- retry count
-
getOperationRetryExceptions
public java.lang.Class<?>[] getOperationRetryExceptions()
This returns the exception types to retry operations on.- Returns:
Class[]
-
getOperationRetryWait
public long getOperationRetryWait()
This returns the operation retry wait time for theLdapConfig
.- Returns:
int
- time limit
-
getOperationRetryBackoff
public int getOperationRetryBackoff()
This returns the factor by which to multiply the operation retry wait time. This allows clients to progressively delay each retry. The formula for backoff is (wait * backoff * attempt). So a wait time of 2s with a backoff of 3 will delay by 6s, then 12s, then 18s, and so forth.- Returns:
int
- backoff factor
-
getDerefLinkFlag
public boolean getDerefLinkFlag()
This returns the derefLinkFlag for theLdapConfig
.- Returns:
boolean
-
getReturningObjFlag
public boolean getReturningObjFlag()
This returns the returningObjFlag for theLdapConfig
.- Returns:
boolean
-
getBatchSize
public int getBatchSize()
This returns the batch size for theLdapConfig
. If this value is -1, then the default provider setting is being used.- Returns:
int
- batch size
-
getDnsUrl
public java.lang.String getDnsUrl()
This returns the dns url for theLdapConfig
. If this value is null, then this property is not being used.- Returns:
String
- dns url
-
getLanguage
public java.lang.String getLanguage()
This returns the preferred language for theLdapConfig
. If this value is null, then the default provider setting is being used.- Returns:
String
- language
-
getReferral
public java.lang.String getReferral()
This returns the referral setting for theLdapConfig
. If this value is null, then the default provider setting is being used.- Returns:
String
- referral
-
getDerefAliases
public java.lang.String getDerefAliases()
This returns the alias setting for theLdapConfig
. If this value is null, then the default provider setting is being used.- Returns:
String
- alias
-
getBinaryAttributes
public java.lang.String getBinaryAttributes()
This returns additional binary attributes for theLdapConfig
. If this value is null, then the default provider setting is being used.- Returns:
String
- binary attributes
-
getSearchResultHandlers
public SearchResultHandler[] getSearchResultHandlers()
This returns the handlers to use for processing search results.- Returns:
SearchResultHandler[]
-
getHandlerIgnoreExceptions
public java.lang.Class<?>[] getHandlerIgnoreExceptions()
This returns the exception types to ignore when handling results.- Returns:
Class[]
-
getSaslAuthorizationId
public java.lang.String getSaslAuthorizationId()
This returns ths SASL authorization id for theLdapConfig
.- Returns:
String
- authorization id
-
getSaslRealm
public java.lang.String getSaslRealm()
This returns ths SASL realm for theLdapConfig
.- Returns:
String
- realm
-
getTypesOnly
public boolean getTypesOnly()
SeeisTypesOnly()
.- Returns:
boolean
-
isTypesOnly
public boolean isTypesOnly()
This returns whether theLdapConfig
is set to only return attribute types.- Returns:
boolean
-
getEnvironmentProperties
public java.util.Map<java.lang.String,java.lang.Object> getEnvironmentProperties()
This returns any environment properties that may have been set for theLdapConfig
usingsetEnvironmentProperties(String,String)
that do not represent properties of this config. The collection returned is unmodifiable.- Returns:
Map
- additional environment properties
-
getLogCredentials
public boolean getLogCredentials()
This returns whether authentication credentials will be logged.- Returns:
boolean
- whether authentication credentials will be logged.
-
getSsl
public boolean getSsl()
SeeisSslEnabled()
.- Returns:
boolean
- whether the SSL protocol is being used
-
isSslEnabled
public boolean isSslEnabled()
This returns whether theLdapConfig
is using the SSL protocol for connections.- Returns:
boolean
- whether the SSL protocol is being used
-
getTls
public boolean getTls()
SeeisTlsEnabled()
.- Returns:
boolean
- whether the TLS protocol is being used
-
isTlsEnabled
public boolean isTlsEnabled()
This returns whether theLdapConfig
is using the TLS protocol for connections.- Returns:
boolean
- whether the TLS protocol is being used
-
setContextFactory
public void setContextFactory(java.lang.String contextFactory)
This sets the context factory of theLdapConfig
.- Parameters:
contextFactory
-String
context factory
-
setConnectionHandler
public void setConnectionHandler(ConnectionHandler connectionHandler)
This sets the connection handler of theLdapConfig
.- Parameters:
connectionHandler
-ConnectionHandler
connection handler
-
setSslSocketFactory
public void setSslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
This sets the SSL socket factory of theLdapConfig
.- Parameters:
sslSocketFactory
-SSLSocketFactory
SSL socket factory
-
setHostnameVerifier
public void setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
This sets the hostname verifier of theLdapConfig
.- Parameters:
hostnameVerifier
-HostnameVerifier
hostname verifier
-
setLdapUrl
public void setLdapUrl(java.lang.String ldapUrl)
This sets the ldap url of theLdapConfig
.- Parameters:
ldapUrl
-String
url
-
setHost
@Deprecated public void setHost(java.lang.String host)
Deprecated.usesetLdapUrl(String)
insteadThis sets the hostname of theLdapConfig
. The host string may be of the form ldap://host.domain.name:389, host.domain.name:389, or host.domain.name. Do not use withsetLdapUrl(String)
.- Parameters:
host
-String
hostname
-
setPort
@Deprecated public void setPort(java.lang.String port)
Deprecated.usesetLdapUrl(String)
insteadThis sets the port of theLdapConfig
. Do not use withsetLdapUrl(String)
.- Parameters:
port
-String
port
-
setTimeout
public void setTimeout(int timeout)
This sets the maximum amount of time in milliseconds that connect operations will block.- Parameters:
timeout
-int
-
setBindDn
public void setBindDn(java.lang.String dn)
This sets the bind DN to authenticate as before performing operations.- Parameters:
dn
-String
bind DN
-
setServiceUser
@Deprecated public void setServiceUser(java.lang.String user)
Deprecated.usesetBindDn(String)
insteadThis sets the username of the service user. user must be a fully qualified DN.- Parameters:
user
-String
username
-
setBindCredential
public void setBindCredential(java.lang.Object credential)
This sets the credential of the bind DN.- Parameters:
credential
-Object
-
setServiceCredential
@Deprecated public void setServiceCredential(java.lang.Object credential)
Deprecated.usesetBindCredential(Object)
insteadThis sets the credential of the service user.- Parameters:
credential
-Object
-
setService
@Deprecated public void setService(java.lang.String user, java.lang.Object credential)
Deprecated.usesetBindDn(String)
andsetBindCredential(Object)
insteadThis sets the username and credential of the service user. user must be a fully qualified DN.- Parameters:
user
-String
service user dncredential
-Object
-
setBase
public void setBase(java.lang.String base)
Deprecated.This sets the base dn for theLdapConfig
.- Parameters:
base
-String
base dn
-
setBaseDn
public void setBaseDn(java.lang.String baseDn)
This sets the base dn for theLdapConfig
.- Parameters:
baseDn
-String
base dn
-
setSearchScope
public void setSearchScope(LdapConfig.SearchScope searchScope)
This sets the search scope for theLdapConfig
.- Parameters:
searchScope
-SearchScope
-
setAuthtype
public void setAuthtype(java.lang.String authtype)
This sets the security level for theLdapConfig
.- Parameters:
authtype
-String
security level
-
setAuthoritative
public void setAuthoritative(boolean authoritative)
This specifies whether or not to force thisLdapConfig
to require an authoritative source.- Parameters:
authoritative
-boolean
-
setTimeLimit
public void setTimeLimit(int timeLimit)
This sets the maximum amount of time in milliseconds that search operations will block.- Parameters:
timeLimit
-int
-
setCountLimit
public void setCountLimit(long countLimit)
This sets the maximum number of entries that search operations will return.- Parameters:
countLimit
-long
-
setPagedResultsSize
public void setPagedResultsSize(int pageSize)
This sets the results size to use when the PagedResultsControl is invoked.- Parameters:
pageSize
-int
-
setOperationRetry
public void setOperationRetry(int operationRetry)
This sets the number of times that ldap operations will be retried if a communication exception occurs.- Parameters:
operationRetry
-int
-
setOperationRetryExceptions
public void setOperationRetryExceptions(java.lang.Class<?>[] exceptions)
This sets the exception types to retry operations on.- Parameters:
exceptions
-Class[]
-
setOperationRetryWait
public void setOperationRetryWait(long wait)
This sets the amount of time in milliseconds that operations should wait before retrying.- Parameters:
wait
-long
-
setOperationRetryBackoff
public void setOperationRetryBackoff(int backoff)
This sets the factor by which to multiply the operation retry wait time. This allows clients to progressively delay each retry. The formula for backoff is (wait * backoff * attempt). So a wait time of 2s with a backoff of 3 will delay by 6s, then 12s, then 18s, and so forth.- Parameters:
backoff
-int
-
setDerefLinkFlag
public void setDerefLinkFlag(boolean derefLinkFlag)
This specifies whether or not to force thisLdapConfig
to link dereferencing during searches.- Parameters:
derefLinkFlag
-boolean
-
setReturningObjFlag
public void setReturningObjFlag(boolean returningObjFlag)
This specifies whether or not to force thisLdapConfig
to return objects for searches.- Parameters:
returningObjFlag
-boolean
-
setBatchSize
public void setBatchSize(int batchSize)
This sets the batch size for theLdapConfig
. A value of -1 indicates to use the provider default.- Parameters:
batchSize
-int
batch size to use when returning results
-
setDnsUrl
public void setDnsUrl(java.lang.String dnsUrl)
This sets the dns url for theLdapConfig
.- Parameters:
dnsUrl
-String
-
setLanguage
public void setLanguage(java.lang.String language)
This sets the preferred language for theLdapConfig
.- Parameters:
language
-String
defined by RFC 1766
-
setReferral
public void setReferral(java.lang.String referral)
This specifies how theLdapConfig
should handle referrals. referral must be one of: "throw", "ignore", or "follow".- Parameters:
referral
-String
-
setDerefAliases
public void setDerefAliases(java.lang.String derefAliases)
This specifies how theLdapConfig
should handle aliases. derefAliases must be one of: "always", "never", "finding", or "searching".- Parameters:
derefAliases
-String
-
setBinaryAttributes
public void setBinaryAttributes(java.lang.String binaryAttributes)
This specifies additional attributes that should be considered binary. Attributes should be space delimited.- Parameters:
binaryAttributes
-String
-
setSearchResultHandlers
public void setSearchResultHandlers(SearchResultHandler[] handlers)
This sets the handlers for processing search results.- Parameters:
handlers
-SearchResultHandler[]
-
setHandlerIgnoreExceptions
public void setHandlerIgnoreExceptions(java.lang.Class<?>[] exceptions)
This sets the exception types to ignore when handling results.- Parameters:
exceptions
-Class[]
-
setSaslAuthorizationId
public void setSaslAuthorizationId(java.lang.String saslAuthorizationId)
This specifies a SASL authorization id.- Parameters:
saslAuthorizationId
-String
-
setSaslRealm
public void setSaslRealm(java.lang.String saslRealm)
This specifies a SASL realm.- Parameters:
saslRealm
-String
-
setTypesOnly
public void setTypesOnly(boolean typesOnly)
This specifies whether or not to force thisLdapConfig
to return only attribute types.- Parameters:
typesOnly
-boolean
-
getPropertiesDomain
public java.lang.String getPropertiesDomain()
This returns the properties domain for this property config.- Specified by:
getPropertiesDomain
in interfacePropertyConfig
- Specified by:
getPropertiesDomain
in classAbstractPropertyConfig
- Returns:
String
properties domain
-
setEnvironmentProperties
public void setEnvironmentProperties(java.lang.String name, java.lang.String value)
This adds environment properties to this object. If name or value is null, then this method does nothing.- Specified by:
setEnvironmentProperties
in interfacePropertyConfig
- Specified by:
setEnvironmentProperties
in classAbstractPropertyConfig
- Parameters:
name
-String
property namevalue
-String
property value
-
hasEnvironmentProperty
public boolean hasEnvironmentProperty(java.lang.String name)
This returns whether the supplied property exists.- Specified by:
hasEnvironmentProperty
in interfacePropertyConfig
- Specified by:
hasEnvironmentProperty
in classAbstractPropertyConfig
- Parameters:
name
-String
to check- Returns:
boolean
whether the supplied property exists
-
createFromProperties
public static LdapConfig createFromProperties(java.io.InputStream is)
Create an instance of this class initialized with properties from the input stream. If the input stream is null, load properties from the default properties file.- Parameters:
is
- to load properties from- Returns:
LdapConfig
initialized ldap config
-
setLogCredentials
public void setLogCredentials(boolean log)
This sets whether authentication credentials will be logged.- Parameters:
log
-boolean
-
setSsl
public void setSsl(boolean ssl)
This sets thisLdapConfig
to use the SSL protocol for connections.- Parameters:
ssl
-boolean
-
setTls
public void setTls(boolean tls)
This sets thisLdapConfig
to use the TLS protocol for connections. Specifically it sets the connection handler to useTlsConnectionHandler
.- Parameters:
tls
-boolean
-
getSearchControls
public javax.naming.directory.SearchControls getSearchControls(java.lang.String[] retAttrs)
This returns aSearchControls
object configured with thisLdapConfig
.- Parameters:
retAttrs
-String[]
attributes to return from search- Returns:
SearchControls
-
getCompareSearchControls
public static javax.naming.directory.SearchControls getCompareSearchControls()
This returns aSearchControls
object configured to perform a LDAP compare operation.- Returns:
SearchControls
-
setTracePackets
public void setTracePackets(java.io.PrintStream stream)
This sets thisLdapConfig
to print ASN.1 BER packets to the suppliedPrintStream
.- Parameters:
stream
-PrintStream
-
toString
public java.lang.String toString()
Provides a descriptive string representation of this instance.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String of the form $Classname@hashCode::env=$env.
-
-