Search in sources :

Example 31 with LdapEntryManager

use of org.gluu.site.ldap.persistence.LdapEntryManager in project oxAuth by GluuFederation.

the class AppInitializer method reloadConfiguration.

private void reloadConfiguration() {
    LdapEntryManager localLdapEntryManager = ldapEntryManagerInstance.get();
    log.trace("Attempting to use {}: {}", LDAP_ENTRY_MANAGER_NAME, localLdapEntryManager.getLdapOperationService());
    List<GluuLdapConfiguration> newLdapAuthConfigs = loadLdapAuthConfigs(localLdapEntryManager);
    if (!this.ldapAuthConfigs.equals(newLdapAuthConfigs)) {
        recreateLdapAuthEntryManagers(newLdapAuthConfigs);
        event.select(ReloadAuthScript.Literal.INSTANCE).fire(ExternalAuthenticationService.MODIFIED_INTERNAL_TYPES_EVENT_TYPE);
        setDefaultAuthenticationMethod(localLdapEntryManager);
    }
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration)

Example 32 with LdapEntryManager

use of org.gluu.site.ldap.persistence.LdapEntryManager in project oxAuth by GluuFederation.

the class AppInitializer method createLdapAuthEntryManager.

@Produces
@ApplicationScoped
@Named(LDAP_AUTH_ENTRY_MANAGER_NAME)
public List<LdapEntryManager> createLdapAuthEntryManager() {
    List<LdapEntryManager> ldapAuthEntryManagers = new ArrayList<LdapEntryManager>();
    if (this.ldapAuthConfigs.size() == 0) {
        return ldapAuthEntryManagers;
    }
    for (int i = 0; i < this.ldapAuthConfigs.size(); i++) {
        LdapEntryManager ldapAuthEntryManager = new LdapEntryManager(new OperationsFacade(this.authConnectionProviders.get(i), this.authBindConnectionProviders.get(i)));
        log.debug("Created {}#{}: {}", new Object[] { LDAP_AUTH_ENTRY_MANAGER_NAME, i, ldapAuthEntryManager });
        ldapAuthEntryManagers.add(ldapAuthEntryManager);
    }
    return ldapAuthEntryManagers;
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) ArrayList(java.util.ArrayList) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 33 with LdapEntryManager

use of org.gluu.site.ldap.persistence.LdapEntryManager in project oxAuth by GluuFederation.

the class AppInitializer method recreateLdapEntryManager.

public void recreateLdapEntryManager(@Observes @LdapConfigurationReload String event) {
    // Get existing application scoped instance
    LdapEntryManager oldLdapEntryManager = CdiUtil.getContextBean(beanManager, LdapEntryManager.class, LDAP_ENTRY_MANAGER_NAME);
    // Recreate components
    createConnectionProvider();
    // Close existing connections
    closeLdapEntryManager(oldLdapEntryManager);
    // Force to create new bean
    LdapEntryManager ldapEntryManager = ldapEntryManagerInstance.get();
    ldapEntryManagerInstance.destroy(ldapEntryManager);
    log.info("Recreated instance {}: {}", LDAP_ENTRY_MANAGER_NAME, ldapEntryManager);
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager)

Aggregations

LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)33 OperationsFacade (org.gluu.site.ldap.OperationsFacade)8 Filter (com.unboundid.ldap.sdk.Filter)6 ArrayList (java.util.ArrayList)6 GluuSimplePerson (org.gluu.oxtrust.ldap.cache.model.GluuSimplePerson)5 ApplicationScoped (javax.enterprise.context.ApplicationScoped)4 Produces (javax.enterprise.inject.Produces)4 Named (javax.inject.Named)4 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)4 GluuLdapConfiguration (org.xdi.model.ldap.GluuLdapConfiguration)4 Properties (java.util.Properties)3 GluuInumMap (org.gluu.oxtrust.ldap.cache.model.GluuInumMap)3 LDAPConnectionProvider (org.gluu.site.ldap.LDAPConnectionProvider)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 List (java.util.List)2 CacheCompoundKey (org.gluu.oxtrust.ldap.cache.model.CacheCompoundKey)2 CustomAttribute (org.xdi.ldap.model.CustomAttribute)2