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

Not all claims get converted #6

Open
ozonni opened this issue Jan 22, 2021 · 4 comments
Open

Not all claims get converted #6

ozonni opened this issue Jan 22, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@ozonni
Copy link

ozonni commented Jan 22, 2021

I only get those headers set but jwt token has more, e.g. client_id or our custom claim account_code

I think it has something to do with _ symbol

X-Kong-JWT-Claim-iss: https://identity.domain.com
X-Kong-JWT-Claim-idp: local
X-Kong-JWT-Claim-sub: xxx
X-Kong-JWT-Claim-sid: xxx
X-Kong-JWT-Claim-name: [email protected]
@nikirago nikirago added the bug Something isn't working label Jan 22, 2021
@nikirago
Copy link
Contributor

Will take a look to see if that is the issue. Thanks for submitting the issue!

@user-e-6
Copy link

user-e-6 commented Feb 4, 2021

I might be completely wrong, but it seems as if only claims with string values are extracted. If you cast the claim to a string before storing it in the token, it should work. Good luck!

@jonathandeclan
Copy link

I am facing the same issue and I think @Aleks-J is correct, claims with boolean, number or array/objects are not converted and are missing.

@MiguelSavignano
Copy link

MiguelSavignano commented Mar 17, 2022

I think the bug is in the headers only accept strings and the source code only allows string values.

    for claim, value in pairs(claims) do
      if type(claim) == "string" and type(value) == "string" then
        kong.service.request.set_header("X-Kong-JWT-Claim-" .. claim, value)
      end
    end

Maybe instead of validating if the claim is a string, is better to transform the clam value to string

    for claim, value in pairs(claims) do
      kong.service.request.set_header("X-Kong-JWT-Claim-" .. tostring(claim), tostring(value))
    end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants