use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method modifyImpl.
public String modifyImpl() {
if (this.initialized) {
return OxTrustConstants.RESULT_SUCCESS;
}
try {
GluuConfiguration configuration = configurationService.getConfiguration();
if (configuration == null) {
return OxTrustConstants.RESULT_FAILURE;
}
this.passportEnable = configuration.isPassportEnabled();
this.customScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION), "displayName", "oxLevel", "oxEnabled");
List<OxIDPAuthConf> list = getIDPAuthConfOrNull(configuration);
this.sourceConfigs = new ArrayList<GluuLdapConfiguration>();
if (list != null) {
for (OxIDPAuthConf oxIDPAuthConf : list) {
GluuLdapConfiguration oxldapConfig = oxIDPAuthConf.getConfig();
this.sourceConfigs.add(oxldapConfig);
}
}
getAuthenticationRecaptcha();
this.authenticationMode = configuration.getAuthenticationMode();
this.oxTrustAuthenticationMode = configuration.getOxTrustAuthenticationMode();
} catch (Exception ex) {
log.error("Failed to load configuration configuration", ex);
return OxTrustConstants.RESULT_FAILURE;
}
this.initialized = true;
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.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.gluu.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()) && ldapConfig.isEnabled()) {
this.customAuthenticationConfigNames.add(ldapConfig.getConfigId());
internalServerName = false;
}
}
if (internalServerName) {
this.customAuthenticationConfigNames.add(OxConstants.SCRIPT_TYPE_INTERNAL_RESERVED_NAME);
}
if (shouldEnableSimplePasswordAuth() && !this.customAuthenticationConfigNames.contains(SIMPLE_PASSWORD_AUTH)) {
this.customAuthenticationConfigNames.add(SIMPLE_PASSWORD_AUTH);
}
}
return this.customAuthenticationConfigNames;
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method updateAuthConf.
public boolean updateAuthConf(GluuConfiguration configuration) {
try {
List<OxIDPAuthConf> idpConf = new ArrayList<OxIDPAuthConf>();
for (GluuLdapConfiguration ldapConfig : this.sourceConfigs) {
if (ldapConfig.isUseAnonymousBind()) {
ldapConfig.setBindDN(null);
}
OxIDPAuthConf ldapConfigIdpAuthConf = new OxIDPAuthConf();
ldapConfig.updateStringsLists();
ldapConfigIdpAuthConf.setType("auth");
ldapConfigIdpAuthConf.setVersion(ldapConfigIdpAuthConf.getVersion() + 1);
ldapConfigIdpAuthConf.setName(ldapConfig.getConfigId());
ldapConfigIdpAuthConf.setEnabled(ldapConfig.isEnabled());
ldapConfigIdpAuthConf.setConfig(ldapConfig);
idpConf.add(ldapConfigIdpAuthConf);
}
configuration.setOxIDPAuthentication(idpConf);
} catch (Exception ex) {
log.error("An Error occured ", ex);
return false;
}
return true;
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class CacheRefreshTimer method processImpl.
private void processImpl(CacheRefreshConfiguration cacheRefreshConfiguration, GluuConfiguration currentConfiguration) throws SearchException {
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, currentConfiguration, sourceServerConnections, inumDbServerConnection, targetServerConnection, updateMethod);
}
} finally {
// Close connections to LDAP servers
try {
closeLdapServerConnection(sourceServerConnections);
} catch (Exception e) {
// Nothing can be done
}
if (!cacheRefreshConfiguration.isDefaultInumServer()) {
try {
closeLdapServerConnection(inumDbServerConnection);
} catch (Exception e) {
// Nothing can be done
}
}
try {
if (isVdsUpdate) {
closeLdapServerConnection(targetServerConnection);
}
} catch (Exception e) {
// Nothing can be done
}
}
return;
}
Aggregations