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

injection opa result as header, local integrasion test pass #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

leeofri
Copy link

@leeofri leeofri commented Jun 17, 2021

No description provided.

Comment on lines 57 to 65
-- it("allow access return baggae in header - default key ", function()
-- _G.ngx.var.upstream_uri = "/api/endpoint/baggage"
-- local res = access.execute(conf)
-- print("lee -spec res")
-- print(res)
-- -- assert.request(res).has.header("baggage")
-- -- assert.is_true(res.headers["baggage"] == "BASE64_JWT_INTERNAL")
-- end)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comments

-- access allowed
kong.log.debug(interp("Access allowed to ${method} ${path} for user ${subject}", {
kong.log.debug(interp("Access 2 allowed to ${method} ${path} for user ${subject}", {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo change

if type(res.result) == "table" then
local baggage_key = conf.policy.baggage_key_in_result
if res.result[baggage_key] ~= nil then
inject_header(baggage_key,res.result.baggage)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug

Suggested change
inject_header(baggage_key,res.result.baggage)
inject_header(baggage_key, res.result[baggage_key])

if res.result[baggage_key] ~= nil then
inject_header(baggage_key,res.result.baggage)
kong.log.debug(interp("Baggage header injected ${baggage}", {
baggage = res.result.baggage

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

Copy link

@Eyal-Shalev Eyal-Shalev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaa

@leeofri leeofri requested a review from Eyal-Shalev June 20, 2021 09:08
Eyal-Shalev
Eyal-Shalev previously approved these changes Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants