From 6a83d48559e415af9ff3e23251c5d9a343553445 Mon Sep 17 00:00:00 2001 From: sshniro Date: Sat, 20 Jun 2020 15:28:31 +0200 Subject: [PATCH] Fix for remote open ID connect introspection --- apisix/plugins/openid-connect.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apisix/plugins/openid-connect.lua b/apisix/plugins/openid-connect.lua index 6a93226f9baa..2572c856ca95 100644 --- a/apisix/plugins/openid-connect.lua +++ b/apisix/plugins/openid-connect.lua @@ -116,11 +116,12 @@ local function introspect(ctx, conf) end else res, err = openidc.introspect(conf) - if res then + if err then + return ngx.HTTP_UNAUTHORIZED, err + else return res end end - if conf.bearer_only then ngx.header["WWW-Authenticate"] = 'Bearer realm="' .. conf.realm .. '",error="' .. err .. '"'