use of org.xdi.model.SimpleCustomProperty in project oxCore by GluuFederation.
the class CustomScriptManager method executeCustomScriptDestroy.
public boolean executeCustomScriptDestroy(CustomScriptConfiguration customScriptConfiguration) {
try {
log.debug("Executing python 'destroy' custom script method");
BaseExternalType externalType = customScriptConfiguration.getExternalType();
Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
return externalType.destroy(configurationAttributes);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
return false;
}
use of org.xdi.model.SimpleCustomProperty in project oxCore by GluuFederation.
the class CustomScript method getModuleProperty.
protected SimpleCustomProperty getModuleProperty(final String modulePropertyName) {
SimpleCustomProperty result = null;
List<SimpleCustomProperty> moduleProperties = getModuleProperties();
if (moduleProperties == null) {
return result;
}
for (SimpleCustomProperty moduleProperty : getModuleProperties()) {
if (StringHelper.equalsIgnoreCase(moduleProperty.getValue1(), modulePropertyName)) {
result = moduleProperty;
break;
}
}
return result;
}
use of org.xdi.model.SimpleCustomProperty in project oxCore by GluuFederation.
the class AuthenticationCustomScript method getUsageType.
public AuthenticationScriptUsageType getUsageType() {
SimpleCustomProperty moduleProperty = getModuleProperty(USAGE_TYPE_MODEL_PROPERTY);
AuthenticationScriptUsageType usageType = null;
if (moduleProperty == null) {
return usageType;
}
return AuthenticationScriptUsageType.getByValue(moduleProperty.getValue2());
}
use of org.xdi.model.SimpleCustomProperty in project oxTrust by GluuFederation.
the class ManageCustomScriptAction method modify.
public String modify() {
if (this.initialized) {
return OxTrustConstants.RESULT_SUCCESS;
}
CustomScriptType[] allowedCustomScriptTypes = this.applianceService.getCustomScriptTypes();
this.customScriptsByTypes = new HashMap<CustomScriptType, List<CustomScript>>();
for (CustomScriptType customScriptType : allowedCustomScriptTypes) {
this.customScriptsByTypes.put(customScriptType, new ArrayList<CustomScript>());
}
try {
List<CustomScript> customScripts = customScriptService.findCustomScripts(Arrays.asList(allowedCustomScriptTypes));
for (CustomScript customScript : customScripts) {
CustomScriptType customScriptType = customScript.getScriptType();
List<CustomScript> customScriptsByType = this.customScriptsByTypes.get(customScriptType);
CustomScript typedCustomScript = customScript;
if (CustomScriptType.PERSON_AUTHENTICATION == customScriptType) {
typedCustomScript = new AuthenticationCustomScript(customScript);
}
if (typedCustomScript.getConfigurationProperties() == null) {
typedCustomScript.setConfigurationProperties(new ArrayList<SimpleCustomProperty>());
}
if (typedCustomScript.getModuleProperties() == null) {
typedCustomScript.setModuleProperties(new ArrayList<SimpleCustomProperty>());
}
customScriptsByType.add(typedCustomScript);
}
} catch (Exception ex) {
log.error("Failed to load custom scripts ", ex);
return OxTrustConstants.RESULT_FAILURE;
}
this.initialized = true;
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.xdi.model.SimpleCustomProperty in project oxTrust by GluuFederation.
the class ManageCustomScriptAction method addCustomScript.
public void addCustomScript(CustomScriptType scriptType) {
List<CustomScript> customScriptsByType = this.customScriptsByTypes.get(scriptType);
CustomScript customScript;
if (CustomScriptType.PERSON_AUTHENTICATION == scriptType) {
AuthenticationCustomScript authenticationCustomScript = new AuthenticationCustomScript();
authenticationCustomScript.setModuleProperties(new ArrayList<SimpleCustomProperty>());
authenticationCustomScript.setUsageType(AuthenticationScriptUsageType.INTERACTIVE);
customScript = authenticationCustomScript;
} else {
customScript = new CustomScript();
customScript.setModuleProperties(new ArrayList<SimpleCustomProperty>());
}
customScript.setLocationType(ScriptLocationType.LDAP);
customScript.setScriptType(scriptType);
customScript.setProgrammingLanguage(ProgrammingLanguage.PYTHON);
customScript.setConfigurationProperties(new ArrayList<SimpleCustomProperty>());
customScriptsByType.add(customScript);
}
Aggregations