use of org.gluu.oxtrust.model.GluuOrganization in project oxTrust by GluuFederation.
the class RegisterPersonAction method initRecaptcha.
private void initRecaptcha() {
GluuOrganization organization = organizationService.getOrganization();
RegistrationConfiguration config = organization.getOxRegistrationConfiguration();
boolean registrationCustomized = config != null;
this.captchaDisabled = !recaptchaService.isEnabled();
if (!this.captchaDisabled) {
this.captchaDisabled = registrationCustomized && config.isCaptchaDisabled();
}
}
use of org.gluu.oxtrust.model.GluuOrganization in project oxTrust by GluuFederation.
the class AuthOrganizationService method getOrganizationCustomMessage.
/**
* Returns custom message defined for the organization
*
* @param customMessageId
* message id
* @return custom message
*/
public String getOrganizationCustomMessage(String customMessageId) throws Exception {
GluuOrganization organization = getOrganization();
String key = OxTrustConstants.CACHE_ORGANIZATION_CUSTOM_MESSAGE_KEY + "_" + organization.getInum();
@SuppressWarnings("unchecked") Map<String, String> organizationCustomMessage = (Map<String, String>) cacheService.get(OxTrustConstants.CACHE_APPLICATION_NAME, key);
if (organizationCustomMessage == null) {
organizationCustomMessage = new HashMap<String, String>();
String[] customMessages = organization.getCustomMessages();
if (ArrayHelper.isNotEmpty(customMessages)) {
for (String customMessage : customMessages) {
int idx = customMessage.indexOf(':');
if ((idx > 0) && (idx + 1 < customMessage.length())) {
String msgKey = customMessage.substring(0, idx).trim();
String msgValue = customMessage.substring(idx + 1).trim();
if (StringHelper.isNotEmpty(msgKey) && StringHelper.isNotEmpty(msgValue)) {
organizationCustomMessage.put(msgKey, msgValue);
}
}
}
}
cacheService.put(OxTrustConstants.CACHE_APPLICATION_NAME, key, organizationCustomMessage);
}
return organizationCustomMessage.get(customMessageId);
}
use of org.gluu.oxtrust.model.GluuOrganization 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.model.GluuOrganization 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.model.GluuOrganization in project oxTrust by GluuFederation.
the class AuthOrganizationService method getOrganizationByInum.
/**
* Get organization by DN
*
* @param inum
* inum
* @return Organization
*/
public GluuOrganization getOrganizationByInum(String inum) throws Exception {
String key = OxTrustConstants.CACHE_ORGANIZATION_KEY + "_" + inum;
GluuOrganization organization = (GluuOrganization) cacheService.get(OxTrustConstants.CACHE_APPLICATION_NAME, key);
if (organization == null) {
organization = ldapAuthEntryManager.find(GluuOrganization.class, getDnForOrganization(inum));
cacheService.put(OxTrustConstants.CACHE_APPLICATION_NAME, key, organization);
}
return organization;
}
Aggregations