use of org.gluu.persist.PersistenceEntryManager 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.persist.PersistenceEntryManager in project oxCore by GluuFederation.
the class StandaloneCustomScriptManagerTest method main.
public static void main(String[] args) {
if (System.getenv("PYTHON_HOME") == null) {
System.err.println("PYTHON_HOME environment variable is not defined");
System.exit(-1);
}
PersistenceEntryManager persistenceEntryManager = createLdapEntryManager();
StandaloneCustomScriptManager customScriptManager = new StandaloneCustomScriptManager(persistenceEntryManager, "ou=scripts,o=gluu", "/opt/gluu/python/libs");
// Register required external scripts
SampleIdpExternalScriptService sampleIdpExternalScriptService = new SampleIdpExternalScriptService();
customScriptManager.registerExternalScriptService(sampleIdpExternalScriptService);
// Init script manager and load scripts
customScriptManager.init();
// Call script
Object context = new SampleContext(System.currentTimeMillis());
sampleIdpExternalScriptService.executeExternalUpdateAttributesMethods(context);
// Reload script if needed
customScriptManager.reload();
// Call script
Object context2 = new SampleContext(System.currentTimeMillis());
sampleIdpExternalScriptService.executeExternalUpdateAttributesMethods(context2);
// Destroy custom script manager and scripts
customScriptManager.destory();
}
use of org.gluu.persist.PersistenceEntryManager in project oxCore by GluuFederation.
the class ConfigurationFactory method createPersistenceEntryManager.
private PersistenceEntryManager createPersistenceEntryManager() {
Properties connectionProperties = preparePersistanceProperties();
PersistenceEntryManagerFactory persistenceEntryManagerFactory = persistanceFactoryService.getPersistenceEntryManagerFactory(persistenceConfiguration);
PersistenceEntryManager persistenceEntryManager = persistenceEntryManagerFactory.createEntryManager(connectionProperties);
LOG.info("Created PersistenceEntryManager: {} with operation service: {}", new Object[] { persistenceEntryManager, persistenceEntryManager.getOperationService() });
return persistenceEntryManager;
}
use of org.gluu.persist.PersistenceEntryManager in project oxCore by GluuFederation.
the class SchemaService method removeObjectClassWithDefinition.
private void removeObjectClassWithDefinition(String objectClassDefinition) {
SchemaEntry schemaEntry = new SchemaEntry();
schemaEntry.setDn(getDnForSchema());
schemaEntry.addObjectClass(objectClassDefinition);
log.debug("Removing objectClass: {}", schemaEntry);
PersistenceEntryManager ldapPersistenceEntryManager = getPersistenceEntryManager();
ldapPersistenceEntryManager.remove(schemaEntry);
}
use of org.gluu.persist.PersistenceEntryManager in project oxCore by GluuFederation.
the class SchemaService method removeStringAttribute.
/**
* Remove string attribute
*
* @param attributeType
* Attribute type name
* @throws Exception
*/
public void removeStringAttribute(String attributeType) throws Exception {
SchemaEntry schema = getSchema();
String attributeTypeDefinition = getAttributeTypeDefinition(schema, attributeType);
if (attributeTypeDefinition != null) {
SchemaEntry schemaEntry = new SchemaEntry();
schemaEntry.setDn(getDnForSchema());
schemaEntry.addAttributeType(attributeTypeDefinition);
log.debug("Removing attributeType: {}", schemaEntry);
PersistenceEntryManager ldapPersistenceEntryManager = getPersistenceEntryManager();
ldapPersistenceEntryManager.remove(schemaEntry);
}
}
Aggregations