public class LdapConfig extends AbstractPropertyConfig
LdapConfig
contains all the configuration data that the
Ldap
needs to control connections and searching.Modifier and Type | Class and Description |
---|---|
static class |
LdapConfig.SearchScope
Enum to define the type of search scope.
|
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTIES_DOMAIN
Domain to look for ldap properties in, value is "edu.vt.middleware.ldap.".
|
logger
Constructor and Description |
---|
LdapConfig()
Default constructor.
|
LdapConfig(String ldapUrl)
This will create a new
LdapConfig with the supplied ldap url. |
LdapConfig(String ldapUrl,
String baseDn)
This will create a new
LdapConfig with the supplied ldap url
and base Strings. |
Modifier and Type | Method and Description |
---|---|
static LdapConfig |
createFromProperties(InputStream is)
Create an instance of this class initialized with properties from the input
stream.
|
boolean |
getAuthoritative()
See
isAuthoritative() . |
String |
getAuthtype()
This returns the security level for the
LdapConfig . |
String |
getBase()
Deprecated.
use
getBaseDn() instead |
String |
getBaseDn()
This returns the base dn for the
LdapConfig . |
int |
getBatchSize()
This returns the batch size for the
LdapConfig . |
String |
getBinaryAttributes()
This returns additional binary attributes for the
LdapConfig . |
Object |
getBindCredential()
This returns the credential used with the bind DN.
|
String |
getBindDn()
This returns the bind DN.
|
static SearchControls |
getCompareSearchControls()
This returns a
SearchControls object configured to perform a
LDAP compare operation. |
ConnectionHandler |
getConnectionHandler()
This returns the connection handler of the
LdapConfig . |
String |
getContextFactory()
This returns the context factory of the
LdapConfig . |
long |
getCountLimit()
This returns the count limit for the
LdapConfig . |
String |
getDerefAliases()
This returns the alias setting for the
LdapConfig . |
boolean |
getDerefLinkFlag()
This returns the derefLinkFlag for the
LdapConfig . |
String |
getDnsUrl()
This returns the dns url for the
LdapConfig . |
Hashtable<String,?> |
getEnvironment()
This returns the Context environment properties that are used to make LDAP
connections.
|
Map<String,Object> |
getEnvironmentProperties()
This returns any environment properties that may have been set for the
LdapConfig using setEnvironmentProperties(String,String) that do not represent properties
of this config. |
Class<?>[] |
getHandlerIgnoreExceptions()
This returns the exception types to ignore when handling results.
|
String |
getHost()
Deprecated.
use
getLdapUrl() instead |
HostnameVerifier |
getHostnameVerifier()
This returns the hostname verifier of the
LdapConfig . |
String |
getLanguage()
This returns the preferred language for the
LdapConfig . |
String |
getLdapUrl()
This returns the ldap url of the
LdapConfig . |
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.
|
Class<?>[] |
getOperationRetryExceptions()
This returns the exception types to retry operations on.
|
long |
getOperationRetryWait()
This returns the operation retry wait time for the
LdapConfig . |
int |
getPagedResultsSize()
This returns the paged results size for the
LdapConfig . |
String |
getPort()
Deprecated.
use
getLdapUrl() instead |
String |
getPropertiesDomain()
This returns the properties domain for this property config.
|
String |
getReferral()
This returns the referral setting for the
LdapConfig . |
boolean |
getReturningObjFlag()
This returns the returningObjFlag for the
LdapConfig . |
String |
getSaslAuthorizationId()
This returns ths SASL authorization id for the
LdapConfig . |
String |
getSaslRealm()
This returns ths SASL realm for the
LdapConfig . |
SearchControls |
getSearchControls(String[] retAttrs)
This returns a
SearchControls object configured with this
LdapConfig . |
SearchResultHandler[] |
getSearchResultHandlers()
This returns the handlers to use for processing search results.
|
LdapConfig.SearchScope |
getSearchScope()
This returns the search scope for the
LdapConfig . |
Object |
getServiceCredential()
Deprecated.
use
getBindCredential() instead |
String |
getServiceUser()
Deprecated.
use
getBindDn() instead |
boolean |
getSsl()
See
isSslEnabled() . |
SSLSocketFactory |
getSslSocketFactory()
This returns the SSL socket factory of the
LdapConfig . |
int |
getTimeLimit()
This returns the time limit for the
LdapConfig . |
int |
getTimeout()
This returns the timeout for the
LdapConfig . |
boolean |
getTls()
See
isTlsEnabled() . |
boolean |
getTypesOnly()
See
isTypesOnly() . |
boolean |
hasEnvironmentProperty(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 the
LdapConfig 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 the
LdapConfig 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 the
LdapConfig is using the TLS protocol
for connections. |
boolean |
isTypesOnly()
This returns whether the
LdapConfig is set to only return
attribute types. |
void |
setAuthoritative(boolean authoritative)
This specifies whether or not to force this
LdapConfig to
require an authoritative source. |
void |
setAuthtype(String authtype)
This sets the security level for the
LdapConfig . |
void |
setBase(String base)
Deprecated.
|
void |
setBaseDn(String baseDn)
This sets the base dn for the
LdapConfig . |
void |
setBatchSize(int batchSize)
This sets the batch size for the
LdapConfig . |
void |
setBinaryAttributes(String binaryAttributes)
This specifies additional attributes that should be considered binary.
|
void |
setBindCredential(Object credential)
This sets the credential of the bind DN.
|
void |
setBindDn(String dn)
This sets the bind DN to authenticate as before performing operations.
|
void |
setConnectionHandler(ConnectionHandler connectionHandler)
This sets the connection handler of the
LdapConfig . |
void |
setContextFactory(String contextFactory)
This sets the context factory of the
LdapConfig . |
void |
setCountLimit(long countLimit)
This sets the maximum number of entries that search operations will return.
|
void |
setDerefAliases(String derefAliases)
This specifies how the
LdapConfig should handle aliases. |
void |
setDerefLinkFlag(boolean derefLinkFlag)
This specifies whether or not to force this
LdapConfig to link
dereferencing during searches. |
void |
setDnsUrl(String dnsUrl)
This sets the dns url for the
LdapConfig . |
void |
setEnvironmentProperties(String name,
String value)
This adds environment properties to this object.
|
void |
setHandlerIgnoreExceptions(Class<?>[] exceptions)
This sets the exception types to ignore when handling results.
|
void |
setHost(String host)
Deprecated.
use
setLdapUrl(String) instead |
void |
setHostnameVerifier(HostnameVerifier hostnameVerifier)
This sets the hostname verifier of the
LdapConfig . |
void |
setLanguage(String language)
This sets the preferred language for the
LdapConfig . |
void |
setLdapUrl(String ldapUrl)
This sets the ldap url of the
LdapConfig . |
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(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(String port)
Deprecated.
use
setLdapUrl(String) instead |
void |
setReferral(String referral)
This specifies how the
LdapConfig should handle referrals. |
void |
setReturningObjFlag(boolean returningObjFlag)
This specifies whether or not to force this
LdapConfig to
return objects for searches. |
void |
setSaslAuthorizationId(String saslAuthorizationId)
This specifies a SASL authorization id.
|
void |
setSaslRealm(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 the
LdapConfig . |
void |
setService(String user,
Object credential)
Deprecated.
use
setBindDn(String) and setBindCredential(Object) instead |
void |
setServiceCredential(Object credential)
Deprecated.
use
setBindCredential(Object) instead |
void |
setServiceUser(String user)
Deprecated.
use
setBindDn(String) instead |
void |
setSsl(boolean ssl)
This sets this
LdapConfig to use the SSL protocol for
connections. |
void |
setSslSocketFactory(SSLSocketFactory sslSocketFactory)
This sets the SSL socket factory of the
LdapConfig . |
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 this
LdapConfig to use the TLS protocol for
connections. |
void |
setTracePackets(PrintStream stream)
This sets this
LdapConfig to print ASN.1 BER packets to the
supplied PrintStream . |
void |
setTypesOnly(boolean typesOnly)
This specifies whether or not to force this
LdapConfig to
return only attribute types. |
String |
toString()
Provides a descriptive string representation of this instance.
|
boolean |
useHostnameVerifier()
This returns whether the
LdapConfig is using a custom hostname
verifier. |
boolean |
useSslSocketFactory()
This returns whether the
LdapConfig is using a custom SSL
socket factory. |
checkImmutable, checkStringInput, makeImmutable, setEnvironmentProperties, setEnvironmentProperties
public static final String PROPERTIES_DOMAIN
public LdapConfig()
public LdapConfig(String ldapUrl)
LdapConfig
with the supplied ldap url.ldapUrl
- String
LDAP URLpublic Hashtable<String,?> getEnvironment()
Hashtable
- context environmentpublic String getContextFactory()
LdapConfig
.String
- context factorypublic ConnectionHandler getConnectionHandler()
LdapConfig
.ConnectionHandler
- connection handlerpublic SSLSocketFactory getSslSocketFactory()
LdapConfig
.SSLSocketFactory
- SSL socket factorypublic boolean useSslSocketFactory()
LdapConfig
is using a custom SSL
socket factory.boolean
public HostnameVerifier getHostnameVerifier()
LdapConfig
.HostnameVerifier
- hostname verifierpublic boolean useHostnameVerifier()
LdapConfig
is using a custom hostname
verifier.boolean
public String getLdapUrl()
LdapConfig
.String
- ldap url@Deprecated public String getHost()
getLdapUrl()
insteadLdapConfig
.String
- hostname@Deprecated public String getPort()
getLdapUrl()
insteadLdapConfig
.String
- portpublic int getTimeout()
LdapConfig
. If this value is
0, then connect operations will wait indefinitely.int
- timeoutpublic String getBindDn()
String
- DN to bind as@Deprecated public String getServiceUser()
getBindDn()
insteadString
- usernamepublic Object getBindCredential()
Object
- bind DN credential@Deprecated public Object getServiceCredential()
getBindCredential()
insteadObject
- credentialpublic String getBase()
getBaseDn()
insteadLdapConfig
.String
- base dnpublic String getBaseDn()
LdapConfig
.String
- base dnpublic LdapConfig.SearchScope getSearchScope()
LdapConfig
.SearchScope
- search scopepublic boolean isObjectSearchScope()
boolean
public boolean isOneLevelSearchScope()
boolean
public boolean isSubTreeSearchScope()
boolean
public String getAuthtype()
LdapConfig
.String
- security levelpublic boolean isAnonymousAuth()
boolean
public boolean isSimpleAuth()
boolean
public boolean isStrongAuth()
boolean
public boolean isSaslAuth()
boolean
public boolean isExternalAuth()
boolean
public boolean isDigestMD5Auth()
boolean
public boolean isCramMD5Auth()
boolean
public boolean isGSSAPIAuth()
boolean
public boolean getAuthoritative()
isAuthoritative()
.boolean
public boolean isAuthoritative()
LdapConfig
is set to require a
authoritative source.boolean
public int getTimeLimit()
LdapConfig
. If this value
is 0, then search operations will wait indefinitely for an answer.int
- time limitpublic long getCountLimit()
LdapConfig
. If this value
is 0, then search operations will return all the results it finds.long
- count limitpublic int getPagedResultsSize()
LdapConfig
. This
value is used whenever the PagedResultsControl in invoked.int
- page sizepublic int getOperationRetry()
int
- retry countpublic Class<?>[] getOperationRetryExceptions()
Class[]
public long getOperationRetryWait()
LdapConfig
.int
- time limitpublic int getOperationRetryBackoff()
int
- backoff factorpublic boolean getDerefLinkFlag()
LdapConfig
.boolean
public boolean getReturningObjFlag()
LdapConfig
.boolean
public int getBatchSize()
LdapConfig
. If this value
is -1, then the default provider setting is being used.int
- batch sizepublic String getDnsUrl()
LdapConfig
. If this value is
null, then this property is not being used.String
- dns urlpublic String getLanguage()
LdapConfig
. If
this value is null, then the default provider setting is being used.String
- languagepublic String getReferral()
LdapConfig
. If this
value is null, then the default provider setting is being used.String
- referralpublic String getDerefAliases()
LdapConfig
. If this
value is null, then the default provider setting is being used.String
- aliaspublic String getBinaryAttributes()
LdapConfig
.
If this value is null, then the default provider setting is being used.String
- binary attributespublic SearchResultHandler[] getSearchResultHandlers()
SearchResultHandler[]
public Class<?>[] getHandlerIgnoreExceptions()
Class[]
public String getSaslAuthorizationId()
LdapConfig
.String
- authorization idpublic String getSaslRealm()
LdapConfig
.String
- realmpublic boolean getTypesOnly()
isTypesOnly()
.boolean
public boolean isTypesOnly()
LdapConfig
is set to only return
attribute types.boolean
public Map<String,Object> getEnvironmentProperties()
LdapConfig
using setEnvironmentProperties(String,String)
that do not represent properties
of this config. The collection returned is unmodifiable.Map
- additional environment propertiespublic boolean getLogCredentials()
boolean
- whether authentication credentials will be
logged.public boolean getSsl()
isSslEnabled()
.boolean
- whether the SSL protocol is being usedpublic boolean isSslEnabled()
LdapConfig
is using the SSL protocol
for connections.boolean
- whether the SSL protocol is being usedpublic boolean getTls()
isTlsEnabled()
.boolean
- whether the TLS protocol is being usedpublic boolean isTlsEnabled()
LdapConfig
is using the TLS protocol
for connections.boolean
- whether the TLS protocol is being usedpublic void setContextFactory(String contextFactory)
LdapConfig
.contextFactory
- String
context factorypublic void setConnectionHandler(ConnectionHandler connectionHandler)
LdapConfig
.connectionHandler
- ConnectionHandler
connection
handlerpublic void setSslSocketFactory(SSLSocketFactory sslSocketFactory)
LdapConfig
.sslSocketFactory
- SSLSocketFactory
SSL socket factorypublic void setHostnameVerifier(HostnameVerifier hostnameVerifier)
LdapConfig
.hostnameVerifier
- HostnameVerifier
hostname verifierpublic void setLdapUrl(String ldapUrl)
LdapConfig
.ldapUrl
- String
url@Deprecated public void setHost(String host)
setLdapUrl(String)
insteadLdapConfig
. The host string may
be of the form ldap://host.domain.name:389, host.domain.name:389, or
host.domain.name. Do not use with setLdapUrl(String)
.host
- String
hostname@Deprecated public void setPort(String port)
setLdapUrl(String)
insteadLdapConfig
. Do not use with setLdapUrl(String)
.port
- String
portpublic void setTimeout(int timeout)
timeout
- int
public void setBindDn(String dn)
dn
- String
bind DN@Deprecated public void setServiceUser(String user)
setBindDn(String)
insteaduser
- String
usernamepublic void setBindCredential(Object credential)
credential
- Object
@Deprecated public void setServiceCredential(Object credential)
setBindCredential(Object)
insteadcredential
- Object
@Deprecated public void setService(String user, Object credential)
setBindDn(String)
and setBindCredential(Object)
insteaduser
- String
service user dncredential
- Object
public void setBase(String base)
setBaseDn(String)
LdapConfig
.base
- String
base dnpublic void setBaseDn(String baseDn)
LdapConfig
.baseDn
- String
base dnpublic void setSearchScope(LdapConfig.SearchScope searchScope)
LdapConfig
.searchScope
- SearchScope
public void setAuthtype(String authtype)
LdapConfig
.authtype
- String
security levelpublic void setAuthoritative(boolean authoritative)
LdapConfig
to
require an authoritative source.authoritative
- boolean
public void setTimeLimit(int timeLimit)
timeLimit
- int
public void setCountLimit(long countLimit)
countLimit
- long
public void setPagedResultsSize(int pageSize)
pageSize
- int
public void setOperationRetry(int operationRetry)
operationRetry
- int
public void setOperationRetryExceptions(Class<?>[] exceptions)
exceptions
- Class[]
public void setOperationRetryWait(long wait)
wait
- long
public void setOperationRetryBackoff(int backoff)
backoff
- int
public void setDerefLinkFlag(boolean derefLinkFlag)
LdapConfig
to link
dereferencing during searches.derefLinkFlag
- boolean
public void setReturningObjFlag(boolean returningObjFlag)
LdapConfig
to
return objects for searches.returningObjFlag
- boolean
public void setBatchSize(int batchSize)
LdapConfig
. A value of -1
indicates to use the provider default.batchSize
- int
batch size to use when returning
resultspublic void setDnsUrl(String dnsUrl)
LdapConfig
.dnsUrl
- String
public void setLanguage(String language)
LdapConfig
.language
- String
defined by RFC 1766public void setReferral(String referral)
LdapConfig
should handle referrals.
referral must be one of: "throw", "ignore", or "follow".referral
- String
public void setDerefAliases(String derefAliases)
LdapConfig
should handle aliases.
derefAliases must be one of: "always", "never", "finding", or "searching".derefAliases
- String
public void setBinaryAttributes(String binaryAttributes)
binaryAttributes
- String
public void setSearchResultHandlers(SearchResultHandler[] handlers)
handlers
- SearchResultHandler[]
public void setHandlerIgnoreExceptions(Class<?>[] exceptions)
exceptions
- Class[]
public void setSaslAuthorizationId(String saslAuthorizationId)
saslAuthorizationId
- String
public void setSaslRealm(String saslRealm)
saslRealm
- String
public void setTypesOnly(boolean typesOnly)
LdapConfig
to
return only attribute types.typesOnly
- boolean
public String getPropertiesDomain()
getPropertiesDomain
in interface PropertyConfig
getPropertiesDomain
in class AbstractPropertyConfig
String
properties domainpublic void setEnvironmentProperties(String name, String value)
setEnvironmentProperties
in interface PropertyConfig
setEnvironmentProperties
in class AbstractPropertyConfig
name
- String
property namevalue
- String
property valuepublic boolean hasEnvironmentProperty(String name)
hasEnvironmentProperty
in interface PropertyConfig
hasEnvironmentProperty
in class AbstractPropertyConfig
name
- String
to checkboolean
whether the supplied property existspublic static LdapConfig createFromProperties(InputStream is)
is
- to load properties fromLdapConfig
initialized ldap configpublic void setLogCredentials(boolean log)
log
- boolean
public void setSsl(boolean ssl)
LdapConfig
to use the SSL protocol for
connections.ssl
- boolean
public void setTls(boolean tls)
LdapConfig
to use the TLS protocol for
connections. Specifically it sets the connection handler to use TlsConnectionHandler
.tls
- boolean
public SearchControls getSearchControls(String[] retAttrs)
SearchControls
object configured with this
LdapConfig
.retAttrs
- String[]
attributes to return from searchSearchControls
public static SearchControls getCompareSearchControls()
SearchControls
object configured to perform a
LDAP compare operation.SearchControls
public void setTracePackets(PrintStream stream)
LdapConfig
to print ASN.1 BER packets to the
supplied PrintStream
.stream
- PrintStream
Copyright © 2018. All rights reserved.