use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateScopeAction method fillAvailableDynScript.
private void fillAvailableDynScript() {
List<CustomScript> availableScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.DYNAMIC_SCOPE));
List<SelectableEntity<CustomScript>> tmpAvailableDynamicScripts = new ArrayList<SelectableEntity<CustomScript>>();
for (CustomScript dynamicScript : availableScripts) {
if (dynamicScript.isEnabled()) {
tmpAvailableDynamicScripts.add(new SelectableEntity<CustomScript>(dynamicScript));
}
}
availableDynamicScripts.addAll(tmpAvailableDynamicScripts);
}
use of org.gluu.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;
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateScopeAction method searchAvailableDynamicScripts.
public void searchAvailableDynamicScripts() {
if (this.availableDynamicScripts != null) {
selectAddedDynamicScripts();
return;
}
try {
List<CustomScript> availableScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.DYNAMIC_SCOPE), CUSTOM_SCRIPT_RETURN_ATTRIBUTES);
List<SelectableEntity<CustomScript>> tmpAvailableDynamicScripts = new ArrayList<SelectableEntity<CustomScript>>();
for (CustomScript dynamicScript : availableScripts) {
if (dynamicScript.isEnabled()) {
tmpAvailableDynamicScripts.add(new SelectableEntity<CustomScript>(dynamicScript));
}
}
this.availableDynamicScripts = tmpAvailableDynamicScripts;
selectAddedDynamicScripts();
} catch (BasePersistenceException ex) {
log.error("Failed to find available authorization policies", ex);
}
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateGluuRadiusConfigAction method getRoPasswordScripts.
public List<String> getRoPasswordScripts() {
List<String> ret = new ArrayList<String>();
List<CustomScriptType> types = Arrays.asList(CustomScriptType.RESOURCE_OWNER_PASSWORD_CREDENTIALS);
List<CustomScript> scripts = customScriptService.findCustomScripts(types);
for (CustomScript script : scripts) {
if (script.isEnabled())
ret.add(script.getName());
}
return ret;
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class ManageOtherCustomScriptAction method modify.
public String modify() {
if (this.initialized) {
return OxTrustConstants.RESULT_SUCCESS;
}
CustomScriptType[] allowedCustomScriptTypes = getScriptType();
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<SimpleExtendedCustomProperty>());
}
if (typedCustomScript.getModuleProperties() == null) {
typedCustomScript.setModuleProperties(new ArrayList<SimpleCustomProperty>());
}
customScriptsByType.add(typedCustomScript);
}
} catch (Exception ex) {
log.error("Failed to load custom scripts ", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to load custom scripts");
conversationService.endConversation();
return OxTrustConstants.RESULT_FAILURE;
}
this.initialized = true;
return OxTrustConstants.RESULT_SUCCESS;
}
Aggregations