org.keycloak.storage.ldap

## Class LDAPStorageProviderFactory

- java.lang.Object
- - org.keycloak.storage.ldap.LDAPStorageProviderFactory

- All Implemented Interfaces:
    ComponentFactory<LDAPStorageProvider,UserStorageProvider>, ConfiguredProvider, ProviderFactory<UserStorageProvider>, ImportSynchronization, UserStorageProviderFactory<LDAPStorageProvider>

      public class LDAPStorageProviderFactory
      extends Object
      implements UserStorageProviderFactory<LDAPStorageProvider>, ImportSynchronization

  Version:
    $Revision: 1 $
  Author:
    Marek Posolda, Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static List<ProviderConfigProperty>` | `configProperties`
    `static String` | `PROVIDER_NAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LDAPStorageProviderFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` This is called when the server shuts down.
    `LDAPStorageProvider` | `create(KeycloakSession session, ComponentModel model)` called per Keycloak transaction.
    `protected KerberosServerSubjectAuthenticator` | `createKerberosSubjectAuthenticator(CommonKerberosConfig kerberosConfig)`
    `protected KerberosUsernamePasswordAuthenticator` | `createKerberosUsernamePasswordAuthenticator(CommonKerberosConfig kerberosConfig)`
    `protected SPNEGOAuthenticator` | `createSPNEGOAuthenticator(String spnegoToken, CommonKerberosConfig kerberosConfig)`
    `List<ProviderConfigProperty>` | `getConfigProperties()`
    `String` | `getId()` This is the name of the provider and will be showed in the admin console as an option.
    `protected Map<ComponentModel,LDAPConfigDecorator>` | `getLDAPConfigDecorators(KeycloakSession session, ComponentModel ldapModel)`
    `protected SynchronizationResult` | `importLdapUsers(KeycloakSessionFactory sessionFactory, String realmId, ComponentModel fedModel, List<LDAPObject> ldapUsers)`
    `void` | `init(Config.Scope config)` Only called once when the factory is first created.
    `void` | `onCreate(KeycloakSession session, RealmModel realm, ComponentModel model)` Called when UserStorageProviderModel is created.
    `void` | `onUpdate(KeycloakSession session, RealmModel realm, ComponentModel oldModel, ComponentModel newModel)` Called after the component is updated.
    `void` | `preRemove(KeycloakSession session, RealmModel realm, ComponentModel model)` Called before the component is removed.
    `SynchronizationResult` | `sync(KeycloakSessionFactory sessionFactory, String realmId, UserStorageProviderModel model)`
    `protected SynchronizationResult` | `syncImpl(KeycloakSessionFactory sessionFactory, LDAPQuery userQuery, String realmId, ComponentModel fedModel)`
    `protected void` | `syncMappers(KeycloakSessionFactory sessionFactory, String realmId, ComponentModel model)`
    `SynchronizationResult` | `syncSince(Date lastSync, KeycloakSessionFactory sessionFactory, String realmId, UserStorageProviderModel model)`
    `void` | `validateConfiguration(KeycloakSession session, RealmModel realm, ComponentModel config)` Called before a component is created or updated.

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

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

    - ### Methods inherited from interface org.keycloak.storage.UserStorageProviderFactory

      `getCommonProviderConfigProperties, getHelpText, getTypeMetadata, postInit`

    - ### Methods inherited from interface org.keycloak.component.ComponentFactory

      `create`

    - ### Methods inherited from interface org.keycloak.provider.ProviderFactory

      `order`

- - ### Field Detail

    - #### PROVIDER_NAME

          public static final String PROVIDER_NAME

      See Also:
        Constant Field Values

    - #### configProperties

          protected static final List<ProviderConfigProperty> configProperties

  - ### Constructor Detail

    - #### LDAPStorageProviderFactory

          public LDAPStorageProviderFactory()

  - ### Method Detail

    - #### getConfigProperties

          public List<ProviderConfigProperty> getConfigProperties()

      Specified by:
        `getConfigProperties` in interface `ConfiguredProvider`
      Specified by:
        `getConfigProperties` in interface `UserStorageProviderFactory<LDAPStorageProvider>`

    - #### create

          public LDAPStorageProvider create(KeycloakSession session,
                                            ComponentModel model)

      Description copied from interface: `UserStorageProviderFactory`
      called per Keycloak transaction.
      Specified by:
        `create` in interface `ComponentFactory<LDAPStorageProvider,UserStorageProvider>`
      Specified by:
        `create` in interface `UserStorageProviderFactory<LDAPStorageProvider>`

    - #### getLDAPConfigDecorators

          protected Map<ComponentModel,LDAPConfigDecorator> getLDAPConfigDecorators(KeycloakSession session,
                                                                                    ComponentModel ldapModel)

    - #### validateConfiguration

          public void validateConfiguration(KeycloakSession session,
                                            RealmModel realm,
                                            ComponentModel config)
                                     throws ComponentValidationException

      Description copied from interface: `ComponentFactory`
      Called before a component is created or updated. Allows you to validate the configuration
      Specified by:
        `validateConfiguration` in interface `ComponentFactory<LDAPStorageProvider,UserStorageProvider>`
      Specified by:
        `validateConfiguration` in interface `UserStorageProviderFactory<LDAPStorageProvider>`
      Throws:
        `ComponentValidationException`

    - #### init

          public void init(Config.Scope config)

      Description copied from interface: `ProviderFactory`
      Only called once when the factory is first created. This config is pulled from keycloak_server.json
      Specified by:
        `init` in interface `ProviderFactory<UserStorageProvider>`
      Specified by:
        `init` in interface `UserStorageProviderFactory<LDAPStorageProvider>`

    - #### close

          public void close()

      Description copied from interface: `ProviderFactory`
      This is called when the server shuts down.
      Specified by:
        `close` in interface `ProviderFactory<UserStorageProvider>`
      Specified by:
        `close` in interface `UserStorageProviderFactory<LDAPStorageProvider>`

    - #### getId

          public String getId()

      Description copied from interface: `UserStorageProviderFactory`
      This is the name of the provider and will be showed in the admin console as an option.
      Specified by:
        `getId` in interface `ProviderFactory<UserStorageProvider>`
      Specified by:
        `getId` in interface `UserStorageProviderFactory<LDAPStorageProvider>`

    - #### onCreate

          public void onCreate(KeycloakSession session,
                               RealmModel realm,
                               ComponentModel model)

      Description copied from interface: `UserStorageProviderFactory`
      Called when UserStorageProviderModel is created. This allows you to do initialization of any additional configuration you need to add. For example, you may be introspecting a database or ldap schema to automatically create mappings.
      Specified by:
        `onCreate` in interface `ComponentFactory<LDAPStorageProvider,UserStorageProvider>`
      Specified by:
        `onCreate` in interface `UserStorageProviderFactory<LDAPStorageProvider>`

    - #### onUpdate

          public void onUpdate(KeycloakSession session,
                               RealmModel realm,
                               ComponentModel oldModel,
                               ComponentModel newModel)

      Description copied from interface: `ComponentFactory`
      Called after the component is updated.
      Specified by:
        `onUpdate` in interface `ComponentFactory<LDAPStorageProvider,UserStorageProvider>`
        `oldModel` - old saved model
        `newModel` - new configuration

    - #### preRemove

          public void preRemove(KeycloakSession session,
                                RealmModel realm,
                                ComponentModel model)

      Description copied from interface: `ComponentFactory`
      Called before the component is removed.
      Specified by:
        `preRemove` in interface `ComponentFactory<LDAPStorageProvider,UserStorageProvider>`
        `model` - model of the component, which is going to be removed

    - #### sync

          public SynchronizationResult sync(KeycloakSessionFactory sessionFactory,
                                            String realmId,
                                            UserStorageProviderModel model)

      Specified by:
        `sync` in interface `ImportSynchronization`

    - #### syncSince

          public SynchronizationResult syncSince(Date lastSync,
                                                 KeycloakSessionFactory sessionFactory,
                                                 String realmId,
                                                 UserStorageProviderModel model)

      Specified by:
        `syncSince` in interface `ImportSynchronization`

    - #### syncMappers

          protected void syncMappers(KeycloakSessionFactory sessionFactory,
                                     String realmId,
                                     ComponentModel model)

    - #### syncImpl

          protected SynchronizationResult syncImpl(KeycloakSessionFactory sessionFactory,
                                                   LDAPQuery userQuery,
                                                   String realmId,
                                                   ComponentModel fedModel)

    - #### importLdapUsers

          protected SynchronizationResult importLdapUsers(KeycloakSessionFactory sessionFactory,
                                                          String realmId,
                                                          ComponentModel fedModel,
                                                          List<LDAPObject> ldapUsers)

    - #### createSPNEGOAuthenticator

          protected SPNEGOAuthenticator createSPNEGOAuthenticator(String spnegoToken,
                                                                  CommonKerberosConfig kerberosConfig)

    - #### createKerberosSubjectAuthenticator

          protected KerberosServerSubjectAuthenticator createKerberosSubjectAuthenticator(CommonKerberosConfig kerberosConfig)

    - #### createKerberosUsernamePasswordAuthenticator

          protected KerberosUsernamePasswordAuthenticator createKerberosUsernamePasswordAuthenticator(CommonKerberosConfig kerberosConfig)

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