Search in sources :

Example 11 with GluuLdapConfiguration

use of org.xdi.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method loadLdapAuthConfigs.

private List<GluuLdapConfiguration> loadLdapAuthConfigs(LdapEntryManager localLdapEntryManager) {
    List<GluuLdapConfiguration> ldapAuthConfigs = new ArrayList<GluuLdapConfiguration>();
    List<oxIDPAuthConf> ldapIdpAuthConfigs = loadLdapIdpAuthConfigs(localLdapEntryManager);
    if (ldapIdpAuthConfigs == null) {
        return ldapAuthConfigs;
    }
    for (oxIDPAuthConf ldapIdpAuthConfig : ldapIdpAuthConfigs) {
        GluuLdapConfiguration ldapAuthConfig = loadLdapAuthConfig(ldapIdpAuthConfig);
        if ((ldapAuthConfig != null) && ldapAuthConfig.isEnabled()) {
            ldapAuthConfigs.add(ldapAuthConfig);
        }
    }
    return ldapAuthConfigs;
}
Also used : ArrayList(java.util.ArrayList) org.xdi.oxauth.model.config.oxIDPAuthConf(org.xdi.oxauth.model.config.oxIDPAuthConf) GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration)

Example 12 with GluuLdapConfiguration

use of org.xdi.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.

the class ConfigureCacheRefreshAction method validateLists.

private boolean validateLists() {
    boolean result = true;
    for (GluuLdapConfiguration sourceConfig : this.cacheRefreshConfiguration.getSourceConfigs()) {
        result &= validateList(sourceConfig, "Source", true);
    }
    result &= validateList(this.cacheRefreshConfiguration.getInumConfig(), "Inum", true);
    if (CacheRefreshUpdateMethod.VDS.equals(cacheRefreshConfiguration.getUpdateMethod())) {
        result &= validateList(this.cacheRefreshConfiguration.getTargetConfig(), "Target", false);
    }
    result &= validateList(this.cacheRefreshConfiguration.getKeyAttributes(), "Key attribute");
    result &= validateList(this.cacheRefreshConfiguration.getKeyObjectClasses(), "Object class");
    result &= validateList(this.cacheRefreshConfiguration.getSourceAttributes(), "Source attribute");
    return result;
}
Also used : GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration)

Example 13 with GluuLdapConfiguration

use of org.xdi.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method createAuthConnectionProviders.

private void createAuthConnectionProviders(List<GluuLdapConfiguration> newLdapAuthConfigs) {
    // Backup current references to objects to allow shutdown properly
    List<GluuLdapConfiguration> oldLdapAuthConfigs = ldapAuthConfigInstance.get();
    List<LdapConnectionService> tmpAuthConnectionProviders = new ArrayList<LdapConnectionService>();
    List<LdapConnectionService> tmpAuthBindConnectionProviders = new ArrayList<LdapConnectionService>();
    // Prepare connection providers per LDAP authentication configuration
    for (GluuLdapConfiguration ldapAuthConfig : newLdapAuthConfigs) {
        LdapConnectionProviders ldapConnectionProviders = createAuthConnectionProviders(ldapAuthConfig);
        tmpAuthConnectionProviders.add(ldapConnectionProviders.getConnectionProvider());
        tmpAuthBindConnectionProviders.add(ldapConnectionProviders.getConnectionBindProvider());
    }
    this.ldapAuthConfigs = newLdapAuthConfigs;
    this.authConnectionProviders = tmpAuthConnectionProviders;
    this.authBindConnectionProviders = tmpAuthBindConnectionProviders;
    ldapAuthConfigInstance.destroy(oldLdapAuthConfigs);
}
Also used : ArrayList(java.util.ArrayList) LdapConnectionService(org.xdi.service.ldap.LdapConnectionService) GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration)

Example 14 with GluuLdapConfiguration

use of org.xdi.model.ldap.GluuLdapConfiguration 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 15 with GluuLdapConfiguration

use of org.xdi.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.

the class ManagePersonAuthenticationAction method updateAuthConf.

public boolean updateAuthConf(GluuAppliance appliance) {
    try {
        String configId = null;
        List<OxIDPAuthConf> idpConf = new ArrayList<OxIDPAuthConf>();
        for (GluuLdapConfiguration ldapConfig : this.sourceConfigs) {
            if (idpConf.isEmpty()) {
                configId = ldapConfig.getConfigId();
            }
            if (ldapConfig.isUseAnonymousBind()) {
                ldapConfig.setBindDN(null);
            }
            OxIDPAuthConf ldapConfigIdpAuthConf = new OxIDPAuthConf();
            ldapConfig.setConfigId(configId);
            ldapConfig.updateStringsLists();
            ldapConfigIdpAuthConf.setType("auth");
            ldapConfigIdpAuthConf.setVersion(ldapConfigIdpAuthConf.getVersion() + 1);
            ldapConfigIdpAuthConf.setName(configId);
            ldapConfigIdpAuthConf.setEnabled(ldapConfig.isEnabled());
            ldapConfigIdpAuthConf.setConfig(objectToJson(ldapConfig));
            idpConf.add(ldapConfigIdpAuthConf);
        }
        appliance.setOxIDPAuthentication(idpConf);
    } catch (Exception ex) {
        log.error("An Error occured ", ex);
        return false;
    }
    return true;
}
Also used : ArrayList(java.util.ArrayList) OxIDPAuthConf(org.gluu.oxtrust.model.OxIDPAuthConf) GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) JsonParseException(org.codehaus.jackson.JsonParseException)

Aggregations

GluuLdapConfiguration (org.xdi.model.ldap.GluuLdapConfiguration)15 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)3 JsonParseException (org.codehaus.jackson.JsonParseException)3 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)3 OxIDPAuthConf (org.gluu.oxtrust.model.OxIDPAuthConf)3 BaseMappingException (org.gluu.persist.exception.mapping.BaseMappingException)3 EncryptionException (org.xdi.util.security.StringEncrypter.EncryptionException)3 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)2 LdapOxPassportConfiguration (org.xdi.config.oxtrust.LdapOxPassportConfiguration)2 SocketException (java.net.SocketException)1 EntryPersistenceException (org.gluu.persist.exception.mapping.EntryPersistenceException)1 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)1 CacheRefreshAttributeMapping (org.xdi.config.oxtrust.CacheRefreshAttributeMapping)1 CacheRefreshConfiguration (org.xdi.config.oxtrust.CacheRefreshConfiguration)1 CustomScriptType (org.xdi.model.custom.script.CustomScriptType)1 CustomScript (org.xdi.model.custom.script.model.CustomScript)1 MetricType (org.xdi.model.metric.MetricType)1