Skip to content

Commit

Permalink
test: fix not a function
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 committed Feb 18, 2025
1 parent 7bb33e2 commit a644134
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions apisix/plugins/openid-connect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,24 @@ local function introspect(ctx, conf)
-- It is inefficient that we also need to extract it (just from headers)
-- so we can add it in the configured header. Find a way to use openidc
-- module's internal methods to extract the token.
local res, err = openidc.bearer_jwt_verify(conf, {
lifetime_grace_period = conf.iat_slack,
aud = function (val, claim)
local ok = conf.client_id == val
return ok, not ok and "Audience does not match the client_id" or nil
end,
})
local res, err = openidc.bearer_jwt_verify(conf,
{ lifetime_grace_period = conf.iat_slack },
{
aud = function (val, claim)
if type(val) == "table" then
for _, v in ipairs(val) do
if conf.client_id == v then
return true
end
end
error("Audience list does not contain the client id")
end
if conf.client_id ~= val then
error("Audience does not match the client id")
end
return true
end,
})

if err then
-- Error while validating or token invalid.
Expand Down

0 comments on commit a644134

Please sign in to comment.