jenskeiner commented on a change in pull request #2903:
URL: https://github.com/apache/apisix/pull/2903#discussion_r533160432



##########
File path: apisix/plugins/openid-connect.lua
##########
@@ -152,26 +225,28 @@ function _M.access(plugin_conf, ctx)
             core.log.error("failed to introspect in openidc: ", err)
             return response
         end
-        if response then
-            add_user_header(response)
-        end
     end
 
     if not response then
+        -- A valid token was not in the request. Try to obtain one by 
authenticatin against the
+        -- configured identity provider.
         local response, err = openidc.authenticate(conf)
         if err then
             core.log.error("failed to authenticate in openidc: ", err)
             return 500
         end
 
         if response then
-            if response.user then
+            -- Add X-Userinfo header, maybe.
+            if conf.set_userinfo_token_header and response.user then
                 add_user_header(response.user)
             end
-            if response.access_token then
-                ngx.req.set_header("X-Access-Token", response.access_token)
-            end
-            if response.id_token then
+
+            -- Add configured access token header, maybe.
+            add_access_token_header(ctx, conf, response.access_token)

Review comment:
       Agreed. Will change.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to