use of org.xdi.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.
the class AuthenticationService method authenticate.
public boolean authenticate(String keyValue, String password, String primaryKey, String localPrimaryKey) {
if (this.ldapAuthConfigs == null) {
return authenticate(null, ldapEntryManager, keyValue, password, primaryKey, localPrimaryKey);
}
boolean authenticated = false;
com.codahale.metrics.Timer.Context timerContext = metricService.getTimer(MetricType.OXAUTH_USER_AUTHENTICATION_RATE).time();
try {
for (int i = 0; i < this.ldapAuthConfigs.size(); i++) {
GluuLdapConfiguration ldapAuthConfig = this.ldapAuthConfigs.get(i);
LdapEntryManager ldapAuthEntryManager = this.ldapAuthEntryManagers.get(i);
authenticated = authenticate(ldapAuthConfig, ldapAuthEntryManager, keyValue, password, primaryKey, localPrimaryKey);
if (authenticated) {
break;
}
}
} finally {
timerContext.stop();
}
MetricType metricType;
if (authenticated) {
metricType = MetricType.OXAUTH_USER_AUTHENTICATION_SUCCESS;
} else {
metricType = MetricType.OXAUTH_USER_AUTHENTICATION_FAILURES;
}
metricService.incCounter(metricType);
return authenticated;
}
use of org.xdi.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.
the class AppInitializer method applicationInitialized.
public void applicationInitialized(@Observes @Initialized(ApplicationScoped.class) Object init) {
createConnectionProvider();
configurationFactory.create();
LdapEntryManager localLdapEntryManager = ldapEntryManagerInstance.get();
List<GluuLdapConfiguration> ldapAuthConfigs = loadLdapAuthConfigs(localLdapEntryManager);
createAuthConnectionProviders(ldapAuthConfigs);
setDefaultAuthenticationMethod(localLdapEntryManager);
// Initialize python interpreter
pythonService.initPythonInterpreter(configurationFactory.getLdapConfiguration().getString("pythonModulesDir", null));
// Initialize script manager
List<CustomScriptType> supportedCustomScriptTypes = Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION, CustomScriptType.CLIENT_REGISTRATION, CustomScriptType.ID_GENERATOR, CustomScriptType.UMA_AUTHORIZATION_POLICY, CustomScriptType.APPLICATION_SESSION, CustomScriptType.DYNAMIC_SCOPE);
// Start timer
quartzSchedulerManager.start();
// Schedule timer tasks
metricService.initTimer();
configurationFactory.initTimer();
ldapStatusTimer.initTimer();
cleanerTimer.initTimer();
customScriptManager.initTimer(supportedCustomScriptTypes);
keyGeneratorTimer.initTimer();
initTimer();
}
use of org.xdi.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.
the class AuthenticationService method externalAuthenticate.
private boolean externalAuthenticate(String keyValue, String password) {
for (int i = 0; i < this.ldapAuthConfigs.size(); i++) {
GluuLdapConfiguration ldapAuthConfig = this.ldapAuthConfigs.get(i);
LdapEntryManager ldapAuthEntryManager = this.ldapAuthEntryManagers.get(i);
String primaryKey = "uid";
if (StringHelper.isNotEmpty(ldapAuthConfig.getPrimaryKey())) {
primaryKey = ldapAuthConfig.getPrimaryKey();
}
String localPrimaryKey = "uid";
if (StringHelper.isNotEmpty(ldapAuthConfig.getLocalPrimaryKey())) {
localPrimaryKey = ldapAuthConfig.getLocalPrimaryKey();
}
boolean authenticated = authenticate(ldapAuthConfig, ldapAuthEntryManager, keyValue, password, primaryKey, localPrimaryKey);
if (authenticated) {
return authenticated;
}
}
return false;
}
use of org.xdi.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class ConfigureCacheRefreshAction method getOxTrustCacheRefreshConfig.
private CacheRefreshConfiguration getOxTrustCacheRefreshConfig() {
CacheRefreshConfiguration cacheRefreshConfiguration = jsonConfigurationService.getOxTrustCacheRefreshConfiguration();
if (cacheRefreshConfiguration == null) {
cacheRefreshConfiguration = new CacheRefreshConfiguration();
cacheRefreshConfiguration.setUpdateMethod(CacheRefreshUpdateMethod.COPY.getValue());
cacheRefreshConfiguration.setSourceConfigs(new ArrayList<GluuLdapConfiguration>());
cacheRefreshConfiguration.setInumConfig(new GluuLdapConfiguration());
cacheRefreshConfiguration.setTargetConfig(new GluuLdapConfiguration());
cacheRefreshConfiguration.setKeyAttributes(new ArrayList<String>(0));
cacheRefreshConfiguration.setKeyObjectClasses(new ArrayList<String>());
cacheRefreshConfiguration.setSourceAttributes(new ArrayList<String>());
cacheRefreshConfiguration.setAttributeMapping(new ArrayList<CacheRefreshAttributeMapping>());
cacheRefreshConfiguration.setDefaultInumServer(true);
}
this.updateMethod = CacheRefreshUpdateMethod.getByValue(cacheRefreshConfiguration.getUpdateMethod());
this.keyAttributes = toSimpleProperties(cacheRefreshConfiguration.getKeyAttributes());
this.keyObjectClasses = toSimpleProperties(cacheRefreshConfiguration.getKeyObjectClasses());
this.sourceAttributes = toSimpleProperties(cacheRefreshConfiguration.getSourceAttributes());
this.attributeMapping = toSimpleCustomProperties(cacheRefreshConfiguration.getAttributeMapping());
return cacheRefreshConfiguration;
}
use of org.xdi.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class ConfigureCacheRefreshAction method addLdapConfig.
@Override
public void addLdapConfig(List<GluuLdapConfiguration> ldapConfigList) {
GluuLdapConfiguration ldapConfiguration = new GluuLdapConfiguration();
ldapConfiguration.setBindPassword("");
ldapConfigList.add(ldapConfiguration);
}
Aggregations