Skip to content

Introduced variable resolver for JSON files

Nils Bandener requested to merge json-var-resolver into main

Adds a new variable resolver json_file that reads JSON files and provides their structure.

So far, the variable resolver file would return file contents always as strings. This is great for 90% of the cases, but sometimes you'd like to add actual JSON subtrees to config structures. An example is the configuration described at https://docs.search-guard.com/latest/json-web-tokens#search-guard-setup where the subtree below jwks corresponds to a JWKS (Java Web Key Set) file.

The json_file variable resolver now provides support for these cases. It always tries to parse a file as JSON. It will cause a validation error if a file is not well-formed JSON. It supports at the top level both JSON objects like {"a": 42} and JSON literals like just 42 or true.

Edited by Nils Bandener

Merge request reports