use of org.gluu.oxtrust.service.python.interfaces.RegistrationScript in project oxTrust by GluuFederation.
the class RegistrationInterceptionService method runPostRegistrationScripts.
public boolean runPostRegistrationScripts(GluuCustomPerson person, Map<String, String[]> requestParameters) {
GluuOrganization org = organizationService.getOrganization();
RegistrationConfiguration config = org.getOxRegistrationConfiguration();
if (config != null && config.isRegistrationInterceptorsConfigured()) {
List<RegistrationInterceptorScript> scripts = config.getRegistrationInterceptorScripts();
List<RegistrationInterceptorScript> sortedEnabledPostRegistrationScripts = sort(getActive(getPostRegistrationScripts(scripts)));
if (sortedEnabledPostRegistrationScripts != null) {
boolean result = true;
for (RegistrationInterceptorScript script : sortedEnabledPostRegistrationScripts) {
RegistrationScript registrationScript = createRegistrationScriptFromStringWithPythonException(script);
result &= registrationScript.execute(script.getCustomAttributes(), person, requestParameters);
}
return result;
} else {
return true;
}
} else {
return true;
}
}
use of org.gluu.oxtrust.service.python.interfaces.RegistrationScript in project oxTrust by GluuFederation.
the class RegistrationInterceptionService method createRegistrationScriptFromStringWithPythonException.
private RegistrationScript createRegistrationScriptFromStringWithPythonException(RegistrationInterceptorScript script) {
String pythonScriptText = script.getCustomScript();
if (pythonScriptText == null) {
return null;
}
RegistrationScript pythonScript = null;
InputStream bis = null;
try {
bis = new ByteArrayInputStream(pythonScriptText.getBytes(Util.UTF8_STRING_ENCODING));
pythonScript = pythonService.loadPythonScript(bis, "RegistrationScriptClass", RegistrationScript.class, new PyObject[] { new PyLong(System.currentTimeMillis()) });
} catch (UnsupportedEncodingException e) {
log.error(e.getMessage(), e);
} catch (PythonException e) {
log.error(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(bis);
}
return pythonScript;
}
use of org.gluu.oxtrust.service.python.interfaces.RegistrationScript in project oxTrust by GluuFederation.
the class RegistrationInterceptionService method runPreRegistrationScripts.
public boolean runPreRegistrationScripts(GluuCustomPerson person, Map<String, String[]> requestParameters) {
GluuOrganization org = organizationService.getOrganization();
RegistrationConfiguration config = org.getOxRegistrationConfiguration();
if (config != null && config.isRegistrationInterceptorsConfigured()) {
List<RegistrationInterceptorScript> scripts = config.getRegistrationInterceptorScripts();
List<RegistrationInterceptorScript> sortedEnabledPreRegistrationScripts = sort(getActive(getPreRegistrationScripts(scripts)));
if (sortedEnabledPreRegistrationScripts != null) {
boolean result = true;
for (RegistrationInterceptorScript script : sortedEnabledPreRegistrationScripts) {
RegistrationScript registrationScript = createRegistrationScriptFromStringWithPythonException(script);
result &= registrationScript.execute(script.getCustomAttributes(), person, requestParameters);
}
return result;
} else {
return true;
}
} else {
return true;
}
}
use of org.gluu.oxtrust.service.python.interfaces.RegistrationScript in project oxTrust by GluuFederation.
the class RegistrationInterceptionService method runInitRegistrationScripts.
public boolean runInitRegistrationScripts(GluuCustomPerson person, Map<String, String[]> requestParameters) {
GluuOrganization org = organizationService.getOrganization();
RegistrationConfiguration config = org.getOxRegistrationConfiguration();
if (config != null && config.isRegistrationInterceptorsConfigured()) {
List<RegistrationInterceptorScript> scripts = config.getRegistrationInterceptorScripts();
List<RegistrationInterceptorScript> sortedEnabledInitRegistrationScripts = sort(getActive(getInitRegistrationScripts(scripts)));
if (sortedEnabledInitRegistrationScripts != null) {
boolean result = true;
for (RegistrationInterceptorScript script : sortedEnabledInitRegistrationScripts) {
RegistrationScript registrationScript = createRegistrationScriptFromStringWithPythonException(script);
result &= registrationScript.execute(script.getCustomAttributes(), person, requestParameters);
}
return result;
} else {
return true;
}
} else {
return true;
}
}
Aggregations