From c9cdee8b09b25ccf52045b43d288e4d83f9cd973 Mon Sep 17 00:00:00 2001 From: "Qirui(Keery) Nie" Date: Tue, 9 Aug 2022 21:45:56 +0800 Subject: [PATCH] [FT-2788]fix opa documents undefined return (#4211) * [FT-2788]fix opa documents undefined return * add missing config params * copy edit + vale Co-authored-by: angel --- app/_hub/kong-inc/opa/_index.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/_hub/kong-inc/opa/_index.md b/app/_hub/kong-inc/opa/_index.md index 9d918d059d2e..08553a866a8e 100644 --- a/app/_hub/kong-inc/opa/_index.md +++ b/app/_hub/kong-inc/opa/_index.md @@ -79,6 +79,18 @@ params: default: false description: | If set to true, the Kong Gateway Consumer object in use for the current request (if any) is included as input to OPA. + - name: include_body_in_opa_input + required: false + datatype: boolean + default: false + description: | + If set to true, the current requests' request body is included as input to OPA. + - name: include_parsed_json_body_in_opa_input + required: false + datatype: boolean + default: false + description: | + If set to true and the `Content-Type` header of the current request is `application/json`, the request body will be JSON decoded and the decoded struct is included as input to OPA. --- ## Usage @@ -95,7 +107,9 @@ Create an `example.rego` file with the following content: ```rego package example -default allow = false +default allowBoolean = false +default allowDetailed = false + allowBoolean { header_present @@ -140,7 +154,7 @@ curl -XPUT localhost:8181/v1/policies/example --data-binary @example.rego The above command uses OPA's default port 8181. It could be different for your setup. -### Set up Kong Gateway +### Set up {{site.base_gateway}} Set up a Route and Service in {{site.base_gateway}} and then enable the plugin: