use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateClientAction method addCustomScript.
private void addCustomScript(String name) {
if (StringHelper.isEmpty(name)) {
return;
}
CustomScript addCustomScript = new CustomScript();
addCustomScript.setName(name);
if (addCustomScript != null) {
this.customScripts.add(addCustomScript);
}
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateClientAction method updateCustomScripts.
private void updateCustomScripts() {
List<CustomScript> currentCustomScripts = this.customScripts;
if (currentCustomScripts == null || currentCustomScripts.size() == 0) {
this.client.setDefaultAcrValues(null);
return;
}
List<String> customScripts = new ArrayList<String>();
for (CustomScript customScript : currentCustomScripts) {
customScripts.add(customScript.getName());
}
this.client.setDefaultAcrValues(customScripts.toArray(new String[customScripts.size()]));
this.client.getAttributes().setPostAuthnScripts(BaseEntry.getDNs(getPostAuthnScripts()));
this.client.getAttributes().setRptClaimsScripts(BaseEntry.getDNs(getRptClaimsScripts()));
this.client.getAttributes().setConsentGatheringScripts(BaseEntry.getDNs(getConsentScripts()));
this.client.getAttributes().setIntrospectionScripts(BaseEntry.getDNs(getIntrospectionScripts()));
this.client.getAttributes().setSpontaneousScopeScriptDns(BaseEntry.getDNs(getSpontaneousScopesScripts()));
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class UpdateScopeAction method updateDynamicScripts.
private void updateDynamicScripts() {
if ((this.dynamicScripts == null) || (this.dynamicScripts.size() == 0)) {
this.scope.setDynamicScopeScripts(null);
return;
}
List<String> resultDynamicScripts = new ArrayList<String>();
for (CustomScript dynamicScript : this.dynamicScripts) {
resultDynamicScripts.add(dynamicScript.getDn());
}
this.scope.setDynamicScopeScripts(resultDynamicScripts);
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class CustomScriptWebResource method updateCustomScript.
@PUT
@Operation(summary = "Update custom script", description = "Update custom script")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CustomScript.class)), description = "Success"), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response updateCustomScript(CustomScript customScript) {
try {
Objects.requireNonNull(customScript, "Attempt to update null custom script");
String inum = customScript.getInum();
log(logger, "Update custom script " + inum);
CustomScript existingScript = customScriptService.getScriptByInum(customScript.getInum());
if (existingScript != null) {
customScript.setInum(existingScript.getInum());
customScriptService.update(customScript);
return Response.ok().build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
} catch (Exception e) {
log(logger, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
use of org.gluu.model.custom.script.model.CustomScript in project oxTrust by GluuFederation.
the class GluuRadiusConfigWebResource method isValidAcrValue.
private final boolean isValidAcrValue(String acrValue) {
List<CustomScriptType> script_types = new ArrayList<CustomScriptType>();
script_types.add(CustomScriptType.RESOURCE_OWNER_PASSWORD_CREDENTIALS);
List<CustomScript> allowed_scripts = customScriptService.findCustomScripts(script_types);
for (CustomScript custom_script : allowed_scripts) {
if (!custom_script.isEnabled())
continue;
if (StringUtils.equals(custom_script.getName(), acrValue))
return true;
}
return false;
}
Aggregations