-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(jwt) : add feature to jwt plugin:allow set headers from claim #13368
base: master
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but a test, changelog file and an entry to the removed_fields
list is required to accommodate for the schema change. The test should cover that the headers_to_set
configuration is handled properly when not specified as well as a variety of sensible configuration values.
Also, you need to sign our CLA.
@jschmid1 any thoughts from you as the subject matter expert?
local consts = { | ||
JWT_CLAIM_HEADER_PREFIX = "X-Jwt-Claim" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't generally create extra tables for local constants. Please change this to just
local consts = { | |
JWT_CLAIM_HEADER_PREFIX = "X-Jwt-Claim" | |
} | |
JWT_CLAIM_HEADER_PREFIX = "X-Jwt-Claim" |
@@ -150,6 +153,15 @@ local function unauthorized(message, www_auth_content, errors) | |||
return { status = 401, message = message, headers = { ["WWW-Authenticate"] = www_auth_content }, errors = errors } | |||
end | |||
|
|||
-- set header keys from claims | |||
local function set_headers(conf, claims) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you rename the function to set_headers_from_claims
, the comment is no longer needed.
Summary
Add feature to jwt plugin: allow set header from claims.
Reopenning of #4761 #5713
Full changelog