Mapping rule simulator (runjs)

Mapping rule simulator (runjs)

Mapping rules in Verify Access OIDC Provider are used to enrich grants and responses. No easy way exists to test the JavaScript mapping rules besides mounting them into the container and performing a runtime flow, where the mapping rules are invoked. Compile time or runtime errors in the mapping rule must be fixed iteratively.

The mapping rule simulator (runjs) is a utility that is provided to simulate the running of a mapping rule in a runtime environment. It uses sample input data that is collected during a runtime flow.

The runjs utility connects to, reads from, and writes to various data sources as configured in the mapping rule. Hence, the runjs utility is intended to run in a staging environment only.

Usage

The runjs utility can be invoked by the docker run command.

docker run --rm --volume <configuration_volume>:/var/isvaop/config --volume <input_volume>:/var/isvaop/input/ icr.io/isva/verify-access-oidc-provider:23.12 /app/runjs <type> <mappingrule_name> <input_json>
  • configuration_volume - The ISVAOP configuration that is mounted for the container to start and connect to various data sources.
  • input_volume - The volume of mapping rules and input in json format to be tested.
  • type - premappingrule or postmappingrule are the only allowed types. premappingrule is invoked to enrich grants and postmappingrule is invoked to enrich the response.
  • mappingrule_name - The mapping rule name that is to be run or tested. The utility looks for the mapping rule in the input volume. If the rule is not found, it then looks it up in the configuration volume.
  • input_json - The input representation in JSON format that is used as input to run the mapping rule. This parameter is optional. If it is not provided, a default input.json file is used.

Example

docker run --rm --volume /home/runjs/isvaop-config:/var/isvaop/config --volume /home/runjs/input:/var/isvaop/input/ icr.io/isva/verify-access-oidc-provider:23.12 /app/runjs premappingrule isvaop_premap.js input.json 

📘

Note

Run the runjs utility in a staging environment only.

To extract information for the mapping rule execution, set the log level to debug.