Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gw ajustments #225

Merged
merged 11 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions interop/authzen-api-gateways/kong-gateway/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ services:
KONG_DATABASE: off
KONG_DECLARATIVE_CONFIG: "/plugins/conf.yaml"
KONG_LUA_PACKAGE_PATH: "/plugins/?.lua"
KONG_NGINX_MAIN_ENV: PDP_KEYS
# PDP KEYS GOES THERE IN JSON FORMAT
PDP_KEYS: '{ "VENDOR":"KEY" }'
ports:
- "8000:8000/tcp"
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,33 @@ local function evaluate(pidreq,conf)
local httpc = http.new()
kong.log.notice("AuthZEN request: ", pidreq)
local pdpurls = conf.server.pdp_url
local keys = os.getenv("PDP_KEYS")
local keysObj = cjson.decode(keys)
local pdps = cjson.decode(pdpurls)
local pdpurl = "https://authzeninteropt.se-plainid.com"
local key = nil
local pdp = ngx.req.get_headers()['x_authzen_gateway_pdp']
if pdp ~= nil then
local tmp = pdps[pdp]
if tmp ~= nil then
pdpurl = tmp
end
key = keysObj[pdp]
end

local uri = pdpurl .. "/access/v1/evaluation"
kong.log.notice("AuthZEN endpoint: " ,uri)

local headers = {
["Content-Type"] = "application/json"
}
if key ~= nil then
headers['Authorization'] = key
end
local res, err = httpc:request_uri(uri, {
method = "POST",
body = pidreq,
headers = {
["Content-Type"] = "application/json"
},
headers = headers,
keepalive_timeout = 60,
keepalive_pool = 10
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ return {
type = "string",
default = "https://authzeninteropt.se-plainid.com"
},
},
{
keys = {
type = "string"
},
}
},
},
Expand Down