use of org.gluu.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.
the class AppInitializer method reloadConfiguration.
private void reloadConfiguration() {
PersistenceEntryManager localPersistenceEntryManager = persistenceEntryManagerInstance.get();
log.trace("Attempting to use {}: {}", ApplicationFactory.PERSISTENCE_ENTRY_MANAGER_NAME, localPersistenceEntryManager.getOperationService());
GluuConfiguration newConfiguration = loadConfiguration(localPersistenceEntryManager, "oxIDPAuthentication", "oxAuthenticationMode");
List<GluuLdapConfiguration> newPersistenceAuthConfigs = loadPersistenceAuthConfigs(newConfiguration);
if (!this.persistenceAuthConfigs.equals(newPersistenceAuthConfigs)) {
recreatePersistenceAuthEntryManagers(newPersistenceAuthConfigs);
this.persistenceAuthConfigs = newPersistenceAuthConfigs;
event.select(ReloadAuthScript.Literal.INSTANCE).fire(ExternalAuthenticationService.MODIFIED_INTERNAL_TYPES_EVENT_TYPE);
}
setDefaultAuthenticationMethod(newConfiguration);
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxAuth by GluuFederation.
the class AppInitializer method recreatePersistenceAuthEntryManagers.
public void recreatePersistenceAuthEntryManagers(List<GluuLdapConfiguration> newPersistenceAuthConfigs) {
// Get existing application scoped instance
List<PersistenceEntryManager> oldPersistenceAuthEntryManagers = CdiUtil.getContextBean(beanManager, new ParameterizedTypeImpl(List.class, PersistenceEntryManager.class), ApplicationFactory.PERSISTENCE_AUTH_ENTRY_MANAGER_NAME);
// Recreate components
this.persistenceAuthConfigs = newPersistenceAuthConfigs;
// Close existing connections
closePersistenceEntryManagers(oldPersistenceAuthEntryManagers);
// Destroy old Ldap auth entry managers
for (PersistenceEntryManager oldPersistenceAuthEntryManager : oldPersistenceAuthEntryManagers) {
log.debug("Attempting to destroy {}: {}", ApplicationFactory.PERSISTENCE_AUTH_ENTRY_MANAGER_NAME, oldPersistenceAuthEntryManager);
oldPersistenceAuthEntryManager.destroy();
log.debug("Destroyed {}: {}", ApplicationFactory.PERSISTENCE_AUTH_ENTRY_MANAGER_NAME, oldPersistenceAuthEntryManager);
externalPersistenceExtensionService.executePersistenceExtensionAfterDestroy(oldPersistenceAuthEntryManager);
}
// Force to create new Ldap auth entry managers bean
List<PersistenceEntryManager> persistenceAuthEntryManagers = persistenceAuthEntryManagerInstance.get();
persistenceAuthEntryManagerInstance.destroy(persistenceAuthEntryManagers);
log.info("Recreated instance {}: {}", ApplicationFactory.PERSISTENCE_AUTH_ENTRY_MANAGER_NAME, persistenceAuthEntryManagers);
// Force to create new auth configuration bean
List<GluuLdapConfiguration> oldPersistenceAuthConfigs = persistenceAuthConfigInstance.get();
persistenceAuthConfigInstance.destroy(oldPersistenceAuthConfigs);
}
use of org.gluu.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);
PersistenceEntryManager 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, false);
if (authenticated) {
return authenticated;
}
}
return false;
}
use of org.gluu.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);
}
use of org.gluu.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;
}
Aggregations