Search in sources :

Example 6 with GluuLdapConfiguration

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

the class ManagePersonAuthenticationAction method modify.

public String modify() {
    if (this.initialized) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    try {
        GluuAppliance appliance = applianceService.getAppliance();
        if (appliance == null) {
            return OxTrustConstants.RESULT_FAILURE;
        }
        passportEnable = appliance.getPassportEnabled();
        log.info("passport enabled value  : '{}'", passportEnable);
        this.customScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION), "displayName", "oxLevel", "gluuStatus");
        OxIDPAuthConf idpConf = getIDPAuthConfOrNull(appliance);
        if (idpConf != null) {
            this.ldapConfig = mapLdapConfig(idpConf.getConfig());
        }
        this.existLdapConfigIdpAuthConf = this.ldapConfig != null;
        if (this.ldapConfig == null) {
            this.ldapConfig = new GluuLdapConfiguration();
        }
        this.authenticationMode = appliance.getAuthenticationMode();
        this.oxTrustAuthenticationMode = appliance.getOxTrustAuthenticationMode();
        ldapOxPassportConfiguration = passportService.loadConfigurationFromLdap();
        if (ldapOxPassportConfiguration == null) {
            ldapOxPassportConfiguration = new LdapOxPassportConfiguration();
        }
        this.ldapPassportConfigurations = ldapOxPassportConfiguration.getPassportConfigurations();
    } catch (Exception ex) {
        log.error("Failed to load appliance configuration", ex);
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.initialized = true;
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : LdapOxPassportConfiguration(org.xdi.config.oxtrust.LdapOxPassportConfiguration) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) OxIDPAuthConf(org.gluu.oxtrust.model.OxIDPAuthConf) GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) LdapMappingException(org.gluu.site.ldap.persistence.exception.LdapMappingException) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 7 with GluuLdapConfiguration

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

the class CacheRefreshTimer method processImpl.

private void processImpl(CacheRefreshConfiguration cacheRefreshConfiguration, GluuAppliance currentAppliance) {
    CacheRefreshUpdateMethod updateMethod = getUpdateMethod(cacheRefreshConfiguration);
    // Prepare and check connections to LDAP servers
    LdapServerConnection[] sourceServerConnections = prepareLdapServerConnections(cacheRefreshConfiguration, cacheRefreshConfiguration.getSourceConfigs());
    LdapServerConnection inumDbServerConnection;
    if (cacheRefreshConfiguration.isDefaultInumServer()) {
        GluuLdapConfiguration ldapInumConfiguration = new GluuLdapConfiguration();
        ldapInumConfiguration.setConfigId("local_inum");
        ldapInumConfiguration.setBaseDNsStringsList(Arrays.asList(new String[] { OxTrustConstants.CACHE_REFRESH_DEFAULT_BASE_DN }));
        inumDbServerConnection = prepareLdapServerConnection(cacheRefreshConfiguration, ldapInumConfiguration, true);
    } else {
        inumDbServerConnection = prepareLdapServerConnection(cacheRefreshConfiguration, cacheRefreshConfiguration.getInumConfig());
    }
    boolean isVdsUpdate = CacheRefreshUpdateMethod.VDS.equals(updateMethod);
    LdapServerConnection targetServerConnection = null;
    if (isVdsUpdate) {
        targetServerConnection = prepareLdapServerConnection(cacheRefreshConfiguration, cacheRefreshConfiguration.getTargetConfig());
    }
    try {
        if ((sourceServerConnections == null) || (inumDbServerConnection == null) || (isVdsUpdate && (targetServerConnection == null))) {
            log.error("Skipping cache refresh due to invalid server configuration");
        } else {
            detectChangedEntries(cacheRefreshConfiguration, currentAppliance, sourceServerConnections, inumDbServerConnection, targetServerConnection, updateMethod);
        }
    } finally {
        // Close connections to LDAP servers
        try {
            closeLdapServerConnection(sourceServerConnections);
        } catch (Exception e) {
        // Nothing can be done
        }
        try {
            closeLdapServerConnection(inumDbServerConnection);
        } catch (Exception e) {
        // Nothing can be done
        }
        try {
            if (isVdsUpdate) {
                closeLdapServerConnection(targetServerConnection);
            }
        } catch (Exception e) {
        // Nothing can be done
        }
    }
    return;
}
Also used : GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration) EntryPersistenceException(org.gluu.persist.exception.mapping.EntryPersistenceException) BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) SocketException(java.net.SocketException)

Example 8 with GluuLdapConfiguration

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

the class ManagePersonAuthenticationAction method addLdapConfig.

@Override
public void addLdapConfig(List<GluuLdapConfiguration> ldapConfigList) {
    GluuLdapConfiguration ldapConfiguration = new GluuLdapConfiguration();
    ldapConfiguration.setBindPassword("");
    ldapConfigList.add(ldapConfiguration);
}
Also used : GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration)

Example 9 with GluuLdapConfiguration

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

the class ManagePersonAuthenticationAction method getPersonAuthenticationConfigurationNames.

public List<String> getPersonAuthenticationConfigurationNames() {
    if (this.customAuthenticationConfigNames == null) {
        this.customAuthenticationConfigNames = new ArrayList<String>();
        for (CustomScript customScript : this.customScripts) {
            if (customScript.isEnabled()) {
                String name = customScript.getName();
                if (StringHelper.isEmpty(name)) {
                    continue;
                }
                this.customAuthenticationConfigNames.add(customScript.getName());
            }
        }
        boolean internalServerName = true;
        for (GluuLdapConfiguration ldapConfig : this.sourceConfigs) {
            if ((ldapConfig != null) && StringHelper.isNotEmpty(ldapConfig.getConfigId())) {
                this.customAuthenticationConfigNames.add(ldapConfig.getConfigId());
                internalServerName = false;
                break;
            }
        }
        if (internalServerName) {
            this.customAuthenticationConfigNames.add(OxConstants.SCRIPT_TYPE_INTERNAL_RESERVED_NAME);
        }
    }
    return this.customAuthenticationConfigNames;
}
Also used : CustomScript(org.xdi.model.custom.script.model.CustomScript) GluuLdapConfiguration(org.xdi.model.ldap.GluuLdapConfiguration)

Example 10 with GluuLdapConfiguration

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

the class ManagePersonAuthenticationAction method modifyImpl.

public String modifyImpl() {
    if (this.initialized) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    try {
        GluuAppliance appliance = applianceService.getAppliance();
        if (appliance == null) {
            return OxTrustConstants.RESULT_FAILURE;
        }
        passportEnable = appliance.getPassportEnabled();
        log.info("passport enabled value  : '{}'", passportEnable);
        this.customScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION), "displayName", "oxLevel", "gluuStatus");
        List<OxIDPAuthConf> list = getIDPAuthConfOrNull(appliance);
        this.sourceConfigs = new ArrayList<GluuLdapConfiguration>();
        if (list != null) {
            for (OxIDPAuthConf oxIDPAuthConf : list) {
                GluuLdapConfiguration oxldapConfig = mapLdapConfig(oxIDPAuthConf.getConfig());
                this.sourceConfigs.add(oxldapConfig);
            }
        }
        this.authenticationMode = appliance.getAuthenticationMode();
        this.oxTrustAuthenticationMode = appliance.getOxTrustAuthenticationMode();
        ldapOxPassportConfiguration = passportService.loadConfigurationFromLdap();
        if (ldapOxPassportConfiguration == null) {
            ldapOxPassportConfiguration = new LdapOxPassportConfiguration();
        }
        this.ldapPassportConfigurations = ldapOxPassportConfiguration.getPassportConfigurations();
    } catch (Exception ex) {
        log.error("Failed to load appliance configuration", ex);
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.initialized = true;
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : LdapOxPassportConfiguration(org.xdi.config.oxtrust.LdapOxPassportConfiguration) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) 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