Description
I'd like to extend jwt-auth plugin to add a new configuration parameter:
key_claim_name (default value: key). that can be used to specify a different key claim name, to validate the JWT against an Apisix Consumer.
Lil snippet for reference:
function _M.rewrite(conf, ctx)
-- [...]
local key_claim_name = conf.key_claim_name
local user_key = jwt_obj.payload and jwt_obj.payload[key_claim_name]
if not user_key then
return 401, {message = "Missing " .. key_claim_name .. " claim in JWT token"}
end
-- [...]
end
Since it would be set to key by default, it shouldn't change/break any existing setting, but would be helpful for those who are using different JWT "formats".
For example, the company I'm working at is using iss claim as Consumer key. Since we're already using a custom version of the jwt-auth plugin (with this feature implemented), I'd like to integrate this contribution to the official plugin.
Do you think I can make a PR with the changes? 🙂
Description
I'd like to extend jwt-auth plugin to add a new configuration parameter:
key_claim_name(default value:key). that can be used to specify a different key claim name, to validate the JWT against an Apisix Consumer.Lil snippet for reference:
Since it would be set to
keyby default, it shouldn't change/break any existing setting, but would be helpful for those who are using different JWT "formats".For example, the company I'm working at is using
issclaim as Consumer key. Since we're already using a custom version of the jwt-auth plugin (with this feature implemented), I'd like to integrate this contribution to the official plugin.Do you think I can make a PR with the changes? 🙂