use of org.xdi.model.custom.script.model.CustomScript in project oxAuth by GluuFederation.
the class IdGenServiceTest method removeCustomScript.
@Test(dependsOnMethods = "testCustomIdGenerationByPythonScript")
public void removeCustomScript() {
CustomScript customScript = new CustomScript();
customScript.setDn(this.idCustomScriptDn);
ldapEntryManager.remove(customScript);
}
use of org.xdi.model.custom.script.model.CustomScript in project oxAuth by GluuFederation.
the class IdGenServiceTest method buildIdCustomScriptEntry.
private CustomScript buildIdCustomScriptEntry(String idScript) {
String basedInum = configurationFactory.getAppConfiguration().getOrganizationInum();
String customScriptId = basedInum + "!" + INumGenerator.generate(2);
String dn = customScriptService.buildDn(customScriptId);
CustomScript customScript = new CustomScript();
customScript.setDn(dn);
customScript.setInum(customScriptId);
customScript.setProgrammingLanguage(ProgrammingLanguage.PYTHON);
customScript.setScriptType(CustomScriptType.ID_GENERATOR);
customScript.setScript(idScript);
customScript.setName("test_id");
customScript.setLevel(0);
customScript.setEnabled(true);
customScript.setRevision(1);
return customScript;
}
use of org.xdi.model.custom.script.model.CustomScript 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.custom.script.model.CustomScript 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);
}
use of org.xdi.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateScopeAction method getInitialDynamicScripts.
private List<CustomScript> getInitialDynamicScripts() {
List<CustomScript> result = new ArrayList<CustomScript>();
if ((this.scope.getDynamicScopeScripts() == null) || (this.scope.getDynamicScopeScripts().size() == 0)) {
return result;
}
List<DisplayNameEntry> displayNameEntries = lookupService.getDisplayNameEntries(customScriptService.baseDn(), this.scope.getDynamicScopeScripts());
if (displayNameEntries != null) {
for (DisplayNameEntry displayNameEntry : displayNameEntries) {
result.add(new CustomScript(displayNameEntry.getDn(), displayNameEntry.getInum(), displayNameEntry.getDisplayName()));
}
}
return result;
}
Aggregations