Class SimpleDirContextFactoryBuilder

java.lang.Object
org.wildfly.security.auth.realm.ldap.SimpleDirContextFactoryBuilder

public class SimpleDirContextFactoryBuilder extends Object
A simple builder for a DirContextFactory which creates new contexts on demand and disposes of them as soon as they are returned.
Author:
Darran Lofthouse
  • Method Details

    • builder

      public static SimpleDirContextFactoryBuilder builder()
      Construct a new instance.
      Returns:
      the new builder
    • setInitialContextFactory

      public SimpleDirContextFactoryBuilder setInitialContextFactory(String initialContextFactory)
      Set the initial context factory class name.
      Parameters:
      initialContextFactory - the class name
      Returns:
      this builder
    • setProviderUrl

      public SimpleDirContextFactoryBuilder setProviderUrl(String providerUrl)
      Set the provider URL.
      Parameters:
      providerUrl - the provider URL
      Returns:
      this builder
    • setSecurityAuthentication

      public SimpleDirContextFactoryBuilder setSecurityAuthentication(String securityAuthentication)
      Set the security authentication method.
      Parameters:
      securityAuthentication - the authentication method
      Returns:
      this builder
    • setSecurityPrincipal

      public SimpleDirContextFactoryBuilder setSecurityPrincipal(String securityPrincipal)
      Set the authentication principal.
      Parameters:
      securityPrincipal - the principal
      Returns:
      this builder
    • setSecurityCredential

      public SimpleDirContextFactoryBuilder setSecurityCredential(String securityCredential)
      Set the authentication credential. If not set, factory try to obtain it from CredentialSource specified by setCredentialSource(org.wildfly.security.credential.source.CredentialSource) of from AuthenticationContext specified by setAuthenticationContext(AuthenticationContext).
      Parameters:
      securityCredential - the credential
      Returns:
      this builder
    • setCredentialSource

      public SimpleDirContextFactoryBuilder setCredentialSource(org.wildfly.security.credential.source.CredentialSource credentialSource)
      Set the authentication credential source. Alternative to setSecurityCredential(String).
      Parameters:
      credentialSource - the credential source
      Returns:
      this builder
    • setAuthenticationContext

      public SimpleDirContextFactoryBuilder setAuthenticationContext(org.wildfly.security.auth.client.AuthenticationContext authenticationContext)
      Set the authentication context as source of security credential. Alternative to setSecurityCredential(String).
      Parameters:
      authenticationContext - the credential source
      Returns:
      this builder
    • setSocketFactory

      public SimpleDirContextFactoryBuilder setSocketFactory(SocketFactory socketFactory)
      Set the socket factory to be used by LDAP context. Used primarily for SSL connections. If not set, factory try to obtain it from AuthenticationContext specified by setAuthenticationContext(AuthenticationContext).
      Parameters:
      socketFactory - the socket factory
      Returns:
      this builder
    • setConnectTimeout

      public SimpleDirContextFactoryBuilder setConnectTimeout(int connectTimeout)
      Set the timeout for connecting to the server. Set to 0 to ensure waiting for the response infinitely. If not set, 10000 ms will be used.
      Parameters:
      connectTimeout - the timeout for connecting to the server in microseconds
      Returns:
      this builder
    • setReadTimeout

      public SimpleDirContextFactoryBuilder setReadTimeout(int readTimeout)
      Set the read timeout for an LDAP operation. Set to 0 to ensure waiting for the response infinitely. If not set, 60000 ms will be used.
      Parameters:
      readTimeout - the read timeout for an LDAP operation in microseconds
      Returns:
      this builder
    • setConnectionProperties

      public SimpleDirContextFactoryBuilder setConnectionProperties(Properties connectionProperties)

      Set additional connection properties.

      Parameters:
      connectionProperties - the additional connection properties.
      Returns:
      this builder
    • setModule

      public SimpleDirContextFactoryBuilder setModule(org.jboss.modules.Module module)
      Set module which will be used to load context factory and context.
      Parameters:
      module - - module that will be used.
      Returns:
      this builder
    • build

      public DirContextFactory build()
      Build this context factory.
      Returns:
      the context factory