Hi All,
Trying to create a scriptable handler in ForgeRock IG which would create a response object based on some parameters in the current response object.
However, when I use the “response” object in the script, it comes up null.
logger.error("Response object: ${response}")
I also tried sending response.status.code (as an example) as argument to the script. But that comes up as null too. But I have used the same object earlier in the script, and that workes as expected. Please find my route snippet below
{
"name": "SwitchFilter-1",
"type": "SwitchFilter",
"config": {
"onResponse" : [
{
"condition": "${response.status.code == 404}",
"handler": "ScriptableHandler-1"
}]
}
},{
"name": "ScriptableHandler-1",
"type": "ScriptableHandler",
"config": {
"type": "application/x-groovy",
"file": "/app/forgerock/installnew/ig-config/scripts/groovy/errorMessageHandler.groovy",
"args": {"responseEntity" : "${response.status.code}"}
}
}
What’s the right way to access the response object in a ScriptableHandler?