org.keycloak.storage.ldap.idm.store.ldap

## Class LDAPContextManager

- java.lang.Object
- - org.keycloak.storage.ldap.idm.store.ldap.LDAPContextManager

- All Implemented Interfaces:
    AutoCloseable

      public final class LDAPContextManager
      extends Object
      implements AutoCloseable

  Author:
    mhajas

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LDAPContextManager(KeycloakSession session, LDAPConfig connectionProperties)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `static LDAPContextManager` | `create(KeycloakSession session, LDAPConfig connectionProperties)`
    `LdapContext` | `getLdapContext()`
    `static Hashtable<Object,Object>` | `getNonAuthConnectionProperties(LDAPConfig ldapConfig)` This method is used for admin connection and user authentication.
    `static StartTlsResponse` | `startTLS(LdapContext ldapContext, String authType, String bindDN, char[] bindCredential, SSLSocketFactory sslSocketFactory)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LDAPContextManager

          public LDAPContextManager(KeycloakSession session,
                                    LDAPConfig connectionProperties)

  - ### Method Detail

    - #### create

          public static LDAPContextManager create(KeycloakSession session,
                                                  LDAPConfig connectionProperties)

    - #### getLdapContext

          public LdapContext getLdapContext()
                                     throws NamingException

      Throws:
        `NamingException`

    - #### startTLS

          public static StartTlsResponse startTLS(LdapContext ldapContext,
                                                  String authType,
                                                  String bindDN,
                                                  char[] bindCredential,
                                                  SSLSocketFactory sslSocketFactory)
                                           throws NamingException

      Throws:
        `NamingException`

    - #### getNonAuthConnectionProperties

          public static Hashtable<Object,Object> getNonAuthConnectionProperties(LDAPConfig ldapConfig)

      This method is used for admin connection and user authentication. Hence it returns just connection properties NOT related to authentication (properties like bindType, bindDn, bindPassword). Caller of this method needs to fill auth-related connection properties based on the fact whether he does admin connection or user authentication
      Parameters:
        `ldapConfig` -
      Returns:

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`

Copyright © 2021 JBoss by Red Hat. All rights reserved.