The getApiVersion method allows API changes in order to do transparent migration from an old script to a new API. Only include the customScript variable if the value for getApiVersion is greater than 10
responseAsJsonObject - is org.codehaus.jettison.json.JSONObject, you can use any method to manipulate json. context is reference of io.jans.as.service.external.context.ExternalUmaRptClaimsContext (in https://github.com/JanssenFederation/oxauth project, )
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.# Copyright (c) 2020, Janssen## Author: Yuriy Zabrovarnyy##fromio.jans.model.custom.script.type.umaimportUmaRptClaimsTypefromjava.langimportStringclassUmaRptClaims(UmaRptClaimsType):def__init__(self,currentTimeMillis):self.currentTimeMillis=currentTimeMillisdefinit(self,customScript,configurationAttributes):print"RPT Claims script. Initializing ..."print"RPT Claims script. Initialized successfully"returnTruedefdestroy(self,configurationAttributes):print"RPT Claims script. Destroying ..."print"RPT Claims script. Destroyed successfully"returnTruedefgetApiVersion(self):return11# Returns boolean, true - apply changes from script method, false - ignore it.# Note :# responseAsJsonObject - is org.codehaus.jettison.json.JSONObject, you can use any method to manipulate json# context is reference of io.jans.as.service.external.context.ExternalUmaRptClaimsContext (in https://github.com/JanssenFederation/oxauth project, )defmodify(self,rptAsJsonObject,context):rptAsJsonObject.accumulate("key_from_script","value_from_script")returnTrue