org.keycloak.federation.ldap.mappers

## Class LDAPFederationMapperBridge

- java.lang.Object
- - org.keycloak.federation.ldap.mappers.LDAPFederationMapperBridge

- All Implemented Interfaces:
    LDAPFederationMapper, UserFederationMapper, Provider

      public class LDAPFederationMapperBridge
      extends Object
      implements LDAPFederationMapper

  Sufficient if mapper implementation is stateless and doesn't need to "close" any state
  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LDAPFederationMapperBridge(AbstractLDAPFederationMapperFactory factory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beforeLDAPQuery(UserFederationMapperModel mapperModel, LDAPQuery query)` Called before LDAP Identity query for retrieve LDAP users was executed.
    `void` | `close()`
    `List<UserModel>` | `getGroupMembers(UserFederationMapperModel mapperModel, UserFederationProvider ldapProvider, RealmModel realm, GroupModel group, int firstResult, int maxResults)` Return empty list if doesn't support storing of groups
    `boolean` | `onAuthenticationFailure(UserFederationMapperModel mapperModel, LDAPFederationProvider ldapProvider, LDAPObject ldapUser, UserModel user, AuthenticationException ldapException, RealmModel realm)` Called when LDAP authentication of specified user fails.
    `void` | `onImportUserFromLDAP(UserFederationMapperModel mapperModel, LDAPFederationProvider ldapProvider, LDAPObject ldapUser, UserModel user, RealmModel realm, boolean isCreate)` Called when importing user from LDAP to local keycloak DB.
    `void` | `onRegisterUserToLDAP(UserFederationMapperModel mapperModel, LDAPFederationProvider ldapProvider, LDAPObject ldapUser, UserModel localUser, RealmModel realm)` Called when register new user to LDAP - just after user was created in Keycloak DB
    `UserModel` | `proxy(UserFederationMapperModel mapperModel, LDAPFederationProvider ldapProvider, LDAPObject ldapUser, UserModel delegate, RealmModel realm)` Called when invoke proxy on LDAP federation provider
    `UserFederationSyncResult` | `syncDataFromFederationProviderToKeycloak(UserFederationMapperModel mapperModel, UserFederationProvider federationProvider, KeycloakSession session, RealmModel realm)` Sync data from federated storage to Keycloak.
    `UserFederationSyncResult` | `syncDataFromKeycloakToFederationProvider(UserFederationMapperModel mapperModel, UserFederationProvider federationProvider, KeycloakSession session, RealmModel realm)` Sync data from Keycloak back to federated storage

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

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

- - ### Constructor Detail

    - #### LDAPFederationMapperBridge

          public LDAPFederationMapperBridge(AbstractLDAPFederationMapperFactory factory)

  - ### Method Detail

    - #### syncDataFromFederationProviderToKeycloak

          public UserFederationSyncResult syncDataFromFederationProviderToKeycloak(UserFederationMapperModel mapperModel,
                                                                                   UserFederationProvider federationProvider,
                                                                                   KeycloakSession session,
                                                                                   RealmModel realm)

      Description copied from interface: `UserFederationMapper`
      Sync data from federated storage to Keycloak. It's useful just if mapper needs some data preloaded from federated storage (For example load roles from federated provider and sync them to Keycloak database) Applicable just if sync is supported (see UserFederationMapperFactory.getSyncConfig() )
      Specified by:
        `syncDataFromFederationProviderToKeycloak` in interface `UserFederationMapper`
      See Also:
        `UserFederationMapperFactory.getSyncConfig()`

    - #### syncDataFromKeycloakToFederationProvider

          public UserFederationSyncResult syncDataFromKeycloakToFederationProvider(UserFederationMapperModel mapperModel,
                                                                                   UserFederationProvider federationProvider,
                                                                                   KeycloakSession session,
                                                                                   RealmModel realm)

      Description copied from interface: `UserFederationMapper`
      Sync data from Keycloak back to federated storage
      Specified by:
        `syncDataFromKeycloakToFederationProvider` in interface `UserFederationMapper`
      See Also:
        `UserFederationMapperFactory.getSyncConfig()`

    - #### onImportUserFromLDAP

          public void onImportUserFromLDAP(UserFederationMapperModel mapperModel,
                                           LDAPFederationProvider ldapProvider,
                                           LDAPObject ldapUser,
                                           UserModel user,
                                           RealmModel realm,
                                           boolean isCreate)

      Description copied from interface: `LDAPFederationMapper`
      Called when importing user from LDAP to local keycloak DB.
      Specified by:
        `onImportUserFromLDAP` in interface `LDAPFederationMapper`
        `isCreate` - true if we importing new user from LDAP. False if user already exists in Keycloak, but we are upgrading (syncing) it from LDAP

    - #### onRegisterUserToLDAP

          public void onRegisterUserToLDAP(UserFederationMapperModel mapperModel,
                                           LDAPFederationProvider ldapProvider,
                                           LDAPObject ldapUser,
                                           UserModel localUser,
                                           RealmModel realm)

      Description copied from interface: `LDAPFederationMapper`
      Called when register new user to LDAP - just after user was created in Keycloak DB
      Specified by:
        `onRegisterUserToLDAP` in interface `LDAPFederationMapper`

    - #### proxy

          public UserModel proxy(UserFederationMapperModel mapperModel,
                                 LDAPFederationProvider ldapProvider,
                                 LDAPObject ldapUser,
                                 UserModel delegate,
                                 RealmModel realm)

      Description copied from interface: `LDAPFederationMapper`
      Called when invoke proxy on LDAP federation provider
      Specified by:
        `proxy` in interface `LDAPFederationMapper`
      Returns:

    - #### beforeLDAPQuery

          public void beforeLDAPQuery(UserFederationMapperModel mapperModel,
                                      LDAPQuery query)

      Description copied from interface: `LDAPFederationMapper`
      Called before LDAP Identity query for retrieve LDAP users was executed. It allows to change query somehow (add returning attributes from LDAP, change conditions etc)
      Specified by:
        `beforeLDAPQuery` in interface `LDAPFederationMapper`

    - #### getGroupMembers

          public List<UserModel> getGroupMembers(UserFederationMapperModel mapperModel,
                                                 UserFederationProvider ldapProvider,
                                                 RealmModel realm,
                                                 GroupModel group,
                                                 int firstResult,
                                                 int maxResults)

      Description copied from interface: `UserFederationMapper`
      Return empty list if doesn't support storing of groups
      Specified by:
        `getGroupMembers` in interface `UserFederationMapper`

    - #### onAuthenticationFailure

          public boolean onAuthenticationFailure(UserFederationMapperModel mapperModel,
                                                 LDAPFederationProvider ldapProvider,
                                                 LDAPObject ldapUser,
                                                 UserModel user,
                                                 AuthenticationException ldapException,
                                                 RealmModel realm)

      Description copied from interface: `LDAPFederationMapper`
      Called when LDAP authentication of specified user fails. If any mapper returns true from this method, AuthenticationException won't be rethrown!
      Specified by:
        `onAuthenticationFailure` in interface `LDAPFederationMapper`
      Returns:
        true if mapper processed the AuthenticationException and did some actions based on that. In that case, AuthenticationException won't be rethrown!

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

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