Identity Gateway 2024.3

ScriptableFilter

Processes requests and responses by executing a Groovy script. Executed scripts must return one of the following:

To execute the next element in a chain (a filter or a handler), the script must call the expression next.handle(context, request). If the script does not call next.handle(context, request), the chain flow breaks and the script has to build and return its own response by calling one of the following expressions:

  • return myResponse

  • return newResultPromise(myResponse)

Actions on the response returned from the downstream flow must be performed in the Promise’s callback methods.

For information about script properties, available global objects, and automatically imported classes, refer to Scripts. For information about creating scriptable objects in Studio, refer to Scripts in Studio and Configure scriptable throttling.

Usage

{
    "name": string,
    "type": "ScriptableFilter",
    "config": {
        "type": configuration expression<string>,
        "file": configuration expression<string>, // Use either "file"
        "source": [ string, ... ],                // or "source", but not both.
        "args": map,
        "clientHandler": Handler reference
    }
}

Properties

For information about properties for ScriptableFilter, refer to Scripts.

Examples

For an example scriptable filter that recovers policy advices from AM, see the failureHandler property of PolicyEnforcementFilter.