Class LdapConfig

  • All Implemented Interfaces:
    PropertyConfig
    Direct Known Subclasses:
    AuthenticatorConfig

    public class LdapConfig
    extends AbstractPropertyConfig
    LdapConfig contains all the configuration data that the Ldap 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.".
    • Constructor Summary

      Constructors 
      Constructor Description
      LdapConfig()
      Default constructor.
      LdapConfig​(java.lang.String ldapUrl)
      This will create a new LdapConfig with the supplied ldap url.
      LdapConfig​(java.lang.String ldapUrl, java.lang.String baseDn)
      This will create a new LdapConfig 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()
      java.lang.String getAuthtype()
      This returns the security level for the LdapConfig.
      java.lang.String getBase()
      Deprecated.
      use getBaseDn() instead
      java.lang.String getBaseDn()
      This returns the base dn for the LdapConfig.
      int getBatchSize()
      This returns the batch size for the LdapConfig.
      java.lang.String getBinaryAttributes()
      This returns additional binary attributes for the LdapConfig.
      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 a SearchControls object configured to perform a LDAP compare operation.
      ConnectionHandler getConnectionHandler()
      This returns the connection handler of the LdapConfig.
      java.lang.String getContextFactory()
      This returns the context factory of the LdapConfig.
      long getCountLimit()
      This returns the count limit for the LdapConfig.
      java.lang.String getDerefAliases()
      This returns the alias setting for the LdapConfig.
      boolean getDerefLinkFlag()
      This returns the derefLinkFlag for the LdapConfig.
      java.lang.String getDnsUrl()
      This returns the dns url for the LdapConfig.
      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 the LdapConfig using setEnvironmentProperties(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.
      use getLdapUrl() instead
      javax.net.ssl.HostnameVerifier getHostnameVerifier()
      This returns the hostname verifier of the LdapConfig.
      java.lang.String getLanguage()
      This returns the preferred language for the LdapConfig.
      java.lang.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.
      java.lang.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.
      java.lang.String getPort()
      Deprecated.
      use getLdapUrl() instead
      java.lang.String getPropertiesDomain()
      This returns the properties domain for this property config.
      java.lang.String getReferral()
      This returns the referral setting for the LdapConfig.
      boolean getReturningObjFlag()
      This returns the returningObjFlag for the LdapConfig.
      java.lang.String getSaslAuthorizationId()
      This returns ths SASL authorization id for the LdapConfig.
      java.lang.String getSaslRealm()
      This returns ths SASL realm for the LdapConfig.
      javax.naming.directory.SearchControls getSearchControls​(java.lang.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.
      java.lang.Object getServiceCredential()
      Deprecated.
      java.lang.String getServiceUser()
      Deprecated.
      use getBindDn() instead
      boolean getSsl()
      javax.net.ssl.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()
      boolean getTypesOnly()
      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 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​(java.lang.String authtype)
      This sets the security level for the LdapConfig.
      void setBase​(java.lang.String base)
      Deprecated.
      void setBaseDn​(java.lang.String baseDn)
      This sets the base dn for the LdapConfig.
      void setBatchSize​(int batchSize)
      This sets the batch size for the LdapConfig.
      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 the LdapConfig.
      void setContextFactory​(java.lang.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​(java.lang.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​(java.lang.String dnsUrl)
      This sets the dns url for the LdapConfig.
      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.
      use setLdapUrl(String) instead
      void setHostnameVerifier​(javax.net.ssl.HostnameVerifier hostnameVerifier)
      This sets the hostname verifier of the LdapConfig.
      void setLanguage​(java.lang.String language)
      This sets the preferred language for the LdapConfig.
      void setLdapUrl​(java.lang.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​(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.
      use setLdapUrl(String) instead
      void setReferral​(java.lang.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​(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 the LdapConfig.
      void setService​(java.lang.String user, java.lang.Object credential)
      Deprecated.
      void setServiceCredential​(java.lang.Object credential)
      Deprecated.
      void setServiceUser​(java.lang.String user)
      Deprecated.
      use setBindDn(String) instead
      void setSsl​(boolean ssl)
      This sets this LdapConfig to use the SSL protocol for connections.
      void setSslSocketFactory​(javax.net.ssl.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​(java.io.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.
      java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 new LdapConfig 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 new LdapConfig with the supplied ldap url and base Strings.
        Parameters:
        ldapUrl - String LDAP URL
        baseDn - 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 the LdapConfig.
        Returns:
        String - context factory
      • getConnectionHandler

        public ConnectionHandler getConnectionHandler()
        This returns the connection handler of the LdapConfig.
        Returns:
        ConnectionHandler - connection handler
      • getSslSocketFactory

        public javax.net.ssl.SSLSocketFactory getSslSocketFactory()
        This returns the SSL socket factory of the LdapConfig.
        Returns:
        SSLSocketFactory - SSL socket factory
      • useSslSocketFactory

        public boolean useSslSocketFactory()
        This returns whether the LdapConfig is using a custom SSL socket factory.
        Returns:
        boolean
      • getHostnameVerifier

        public javax.net.ssl.HostnameVerifier getHostnameVerifier()
        This returns the hostname verifier of the LdapConfig.
        Returns:
        HostnameVerifier - hostname verifier
      • useHostnameVerifier

        public boolean useHostnameVerifier()
        This returns whether the LdapConfig is using a custom hostname verifier.
        Returns:
        boolean
      • getLdapUrl

        public java.lang.String getLdapUrl()
        This returns the ldap url of the LdapConfig.
        Returns:
        String - ldap url
      • getHost

        @Deprecated
        public java.lang.String getHost()
        Deprecated.
        use getLdapUrl() instead
        This returns the hostname of the LdapConfig.
        Returns:
        String - hostname
      • getPort

        @Deprecated
        public java.lang.String getPort()
        Deprecated.
        use getLdapUrl() instead
        This returns the port of the LdapConfig.
        Returns:
        String - port
      • getTimeout

        public int getTimeout()
        This returns the timeout for the LdapConfig. 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.
        use getBindDn() instead
        This 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.
        This returns the credential of the service user.
        Returns:
        Object - credential
      • getBase

        public java.lang.String getBase()
        Deprecated.
        use getBaseDn() instead
        This returns the base dn for the LdapConfig.
        Returns:
        String - base dn
      • getBaseDn

        public java.lang.String getBaseDn()
        This returns the base dn for the LdapConfig.
        Returns:
        String - base dn
      • getSearchScope

        public LdapConfig.SearchScope getSearchScope()
        This returns the search scope for the LdapConfig.
        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 the LdapConfig.
        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()
        Returns:
        boolean
      • isAuthoritative

        public boolean isAuthoritative()
        This returns whether the LdapConfig is set to require a authoritative source.
        Returns:
        boolean
      • getTimeLimit

        public int getTimeLimit()
        This returns the time limit for the LdapConfig. 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 the LdapConfig. 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 the LdapConfig. 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 the LdapConfig.
        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 the LdapConfig.
        Returns:
        boolean
      • getReturningObjFlag

        public boolean getReturningObjFlag()
        This returns the returningObjFlag for the LdapConfig.
        Returns:
        boolean
      • getBatchSize

        public int getBatchSize()
        This returns the batch size for the LdapConfig. 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 the LdapConfig. 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 the LdapConfig. 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 the LdapConfig. 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 the LdapConfig. 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 the LdapConfig. 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 the LdapConfig.
        Returns:
        String - authorization id
      • getSaslRealm

        public java.lang.String getSaslRealm()
        This returns ths SASL realm for the LdapConfig.
        Returns:
        String - realm
      • getTypesOnly

        public boolean getTypesOnly()
        Returns:
        boolean
      • isTypesOnly

        public boolean isTypesOnly()
        This returns whether the LdapConfig 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 the LdapConfig using setEnvironmentProperties(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()
        Returns:
        boolean - whether the SSL protocol is being used
      • isSslEnabled

        public boolean isSslEnabled()
        This returns whether the LdapConfig is using the SSL protocol for connections.
        Returns:
        boolean - whether the SSL protocol is being used
      • getTls

        public boolean getTls()
        Returns:
        boolean - whether the TLS protocol is being used
      • isTlsEnabled

        public boolean isTlsEnabled()
        This returns whether the LdapConfig 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 the LdapConfig.
        Parameters:
        contextFactory - String context factory
      • setConnectionHandler

        public void setConnectionHandler​(ConnectionHandler connectionHandler)
        This sets the connection handler of the LdapConfig.
        Parameters:
        connectionHandler - ConnectionHandler connection handler
      • setSslSocketFactory

        public void setSslSocketFactory​(javax.net.ssl.SSLSocketFactory sslSocketFactory)
        This sets the SSL socket factory of the LdapConfig.
        Parameters:
        sslSocketFactory - SSLSocketFactory SSL socket factory
      • setHostnameVerifier

        public void setHostnameVerifier​(javax.net.ssl.HostnameVerifier hostnameVerifier)
        This sets the hostname verifier of the LdapConfig.
        Parameters:
        hostnameVerifier - HostnameVerifier hostname verifier
      • setLdapUrl

        public void setLdapUrl​(java.lang.String ldapUrl)
        This sets the ldap url of the LdapConfig.
        Parameters:
        ldapUrl - String url
      • setHost

        @Deprecated
        public void setHost​(java.lang.String host)
        Deprecated.
        use setLdapUrl(String) instead
        This sets the hostname of the LdapConfig. 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).
        Parameters:
        host - String hostname
      • setPort

        @Deprecated
        public void setPort​(java.lang.String port)
        Deprecated.
        use setLdapUrl(String) instead
        This sets the port of the LdapConfig. Do not use with setLdapUrl(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.
        use setBindDn(String) instead
        This 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.
        This sets the credential of the service user.
        Parameters:
        credential - Object
      • setService

        @Deprecated
        public void setService​(java.lang.String user,
                               java.lang.Object credential)
        Deprecated.
        This sets the username and credential of the service user. user must be a fully qualified DN.
        Parameters:
        user - String service user dn
        credential - Object
      • setBase

        public void setBase​(java.lang.String base)
        Deprecated.
        This sets the base dn for the LdapConfig.
        Parameters:
        base - String base dn
      • setBaseDn

        public void setBaseDn​(java.lang.String baseDn)
        This sets the base dn for the LdapConfig.
        Parameters:
        baseDn - String base dn
      • setSearchScope

        public void setSearchScope​(LdapConfig.SearchScope searchScope)
        This sets the search scope for the LdapConfig.
        Parameters:
        searchScope - SearchScope
      • setAuthtype

        public void setAuthtype​(java.lang.String authtype)
        This sets the security level for the LdapConfig.
        Parameters:
        authtype - String security level
      • setAuthoritative

        public void setAuthoritative​(boolean authoritative)
        This specifies whether or not to force this LdapConfig 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 this LdapConfig to link dereferencing during searches.
        Parameters:
        derefLinkFlag - boolean
      • setReturningObjFlag

        public void setReturningObjFlag​(boolean returningObjFlag)
        This specifies whether or not to force this LdapConfig to return objects for searches.
        Parameters:
        returningObjFlag - boolean
      • setBatchSize

        public void setBatchSize​(int batchSize)
        This sets the batch size for the LdapConfig. 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 the LdapConfig.
        Parameters:
        dnsUrl - String
      • setLanguage

        public void setLanguage​(java.lang.String language)
        This sets the preferred language for the LdapConfig.
        Parameters:
        language - String defined by RFC 1766
      • setReferral

        public void setReferral​(java.lang.String referral)
        This specifies how the LdapConfig 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 the LdapConfig 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 this LdapConfig to return only attribute types.
        Parameters:
        typesOnly - boolean
      • 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 interface PropertyConfig
        Specified by:
        setEnvironmentProperties in class AbstractPropertyConfig
        Parameters:
        name - String property name
        value - String property value
      • 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 this LdapConfig to use the SSL protocol for connections.
        Parameters:
        ssl - boolean
      • setTls

        public void setTls​(boolean tls)
        This sets this LdapConfig to use the TLS protocol for connections. Specifically it sets the connection handler to use TlsConnectionHandler.
        Parameters:
        tls - boolean
      • getSearchControls

        public javax.naming.directory.SearchControls getSearchControls​(java.lang.String[] retAttrs)
        This returns a SearchControls object configured with this LdapConfig.
        Parameters:
        retAttrs - String[] attributes to return from search
        Returns:
        SearchControls
      • getCompareSearchControls

        public static javax.naming.directory.SearchControls getCompareSearchControls()
        This returns a SearchControls object configured to perform a LDAP compare operation.
        Returns:
        SearchControls
      • setTracePackets

        public void setTracePackets​(java.io.PrintStream stream)
        This sets this LdapConfig to print ASN.1 BER packets to the supplied PrintStream.
        Parameters:
        stream - PrintStream
      • toString

        public java.lang.String toString()
        Provides a descriptive string representation of this instance.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String of the form $Classname@hashCode::env=$env.