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;
}
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;
}
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);
}
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;
}
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;
}
Aggregations