Search in sources :

Example 1 with LDAPConfigDecorator

use of org.keycloak.storage.ldap.mappers.LDAPConfigDecorator in project keycloak by keycloak.

the class LDAPIdentityStoreRegistry method getLdapStore.

public LDAPIdentityStore getLdapStore(KeycloakSession session, ComponentModel ldapModel, Map<ComponentModel, LDAPConfigDecorator> configDecorators) {
    LDAPIdentityStoreContext context = ldapStores.get(ldapModel.getId());
    // Ldap config might have changed for the realm. In this case, we must re-initialize
    MultivaluedHashMap<String, String> configModel = ldapModel.getConfig();
    LDAPConfig ldapConfig = new LDAPConfig(configModel);
    for (Map.Entry<ComponentModel, LDAPConfigDecorator> entry : configDecorators.entrySet()) {
        ComponentModel mapperModel = entry.getKey();
        LDAPConfigDecorator decorator = entry.getValue();
        decorator.updateLDAPConfig(ldapConfig, mapperModel);
    }
    if (context == null || !ldapConfig.equals(context.config)) {
        logLDAPConfig(session, ldapModel, ldapConfig);
        LDAPIdentityStore store = createLdapIdentityStore(session, ldapConfig);
        context = new LDAPIdentityStoreContext(ldapConfig, store);
        ldapStores.put(ldapModel.getId(), context);
    }
    return context.store;
}
Also used : LDAPIdentityStore(org.keycloak.storage.ldap.idm.store.ldap.LDAPIdentityStore) ComponentModel(org.keycloak.component.ComponentModel) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) MultivaluedHashMap(org.keycloak.common.util.MultivaluedHashMap) LDAPConfigDecorator(org.keycloak.storage.ldap.mappers.LDAPConfigDecorator)

Example 2 with LDAPConfigDecorator

use of org.keycloak.storage.ldap.mappers.LDAPConfigDecorator in project keycloak by keycloak.

the class LDAPStorageProviderFactory method create.

@Override
public LDAPStorageProvider create(KeycloakSession session, ComponentModel model) {
    Map<ComponentModel, LDAPConfigDecorator> configDecorators = getLDAPConfigDecorators(session, model);
    LDAPIdentityStore ldapIdentityStore = this.ldapStoreRegistry.getLdapStore(session, model, configDecorators);
    return new LDAPStorageProvider(this, session, model, ldapIdentityStore);
}
Also used : LDAPIdentityStore(org.keycloak.storage.ldap.idm.store.ldap.LDAPIdentityStore) ComponentModel(org.keycloak.component.ComponentModel) LDAPConfigDecorator(org.keycloak.storage.ldap.mappers.LDAPConfigDecorator)

Aggregations

ComponentModel (org.keycloak.component.ComponentModel)2 LDAPIdentityStore (org.keycloak.storage.ldap.idm.store.ldap.LDAPIdentityStore)2 LDAPConfigDecorator (org.keycloak.storage.ldap.mappers.LDAPConfigDecorator)2 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 MultivaluedHashMap (org.keycloak.common.util.MultivaluedHashMap)1