You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/09 02:02:04 UTC

[GitHub] [apisix] yaule opened a new pull request #6270: feat(oidc): add set_userinfo_detail_header

yaule opened a new pull request #6270:
URL: https://github.com/apache/apisix/pull/6270


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the PR manners:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
   6. Use "request review" to notify the reviewer once you have resolved the review
   7. Only reviewer can click "Resolve conversation" to mark the reviewer's review resolved
   -->
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] yaule commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
yaule commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1038555735


   Grafana requires the header is plaintext, but X-Userinfo is base64 encoded.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] yaule commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
yaule commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1039023920


   Yes, the upstream services do not need base64 decoding user information, they can be obtained directly from X-userinfo-Detail-*


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] yaule commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
yaule commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1034309783


   > hi @yaule , thanks for submitting the PR, can you explain the background of this PR?
   
   The service behind APISIX can directly obtain user information from the header, without using base64 to encode the data, like grafana


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1039260840


   > Yes, the upstream services do not need base64 decoding user information, they can be obtained directly from X-userinfo-Detail-*
   
   My concern is that this is only grafana usage and is not a universal standard.
   I would like to know if there are more common standards that support this header.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1038599088


   > Grafana requires the header is plaintext, but X-Userinfo is base64 encoded.
   
   Another question, is there an introduction to `X-Userinfo-Detail-*`? Is this header specifically for Grafana?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] yaule commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
yaule commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1038555735


   Grafana requires the header is plaintext, but X-Userinfo is base64 encoded.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1033290896


   hi @yaule , thanks for submitting the PR, can you explain the background of this PR?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] starsz commented on a change in pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#discussion_r802322836



##########
File path: apisix/plugins/openid-connect.lua
##########
@@ -317,6 +323,13 @@ function _M.rewrite(plugin_conf, ctx)
                 core.request.set_header(ctx, "X-Userinfo",
                     ngx_encode_base64(core.json.encode(response.user)))
             end
+            -- Add X-Userinfo-Detail header, maybe.
+            if response.user and conf.set_userinfo_detail_header then
+                for k in string.gmatch(conf.scope..' ', '(.-)'..' ')

Review comment:
       ```suggestion
                   for k in string.gmatch(conf.scope .. ' ', '(.-)' .. ' ')
   ```

##########
File path: apisix/plugins/openid-connect.lua
##########
@@ -317,6 +323,13 @@ function _M.rewrite(plugin_conf, ctx)
                 core.request.set_header(ctx, "X-Userinfo",
                     ngx_encode_base64(core.json.encode(response.user)))
             end
+            -- Add X-Userinfo-Detail header, maybe.
+            if response.user and conf.set_userinfo_detail_header then
+                for k in string.gmatch(conf.scope..' ', '(.-)'..' ')
+                do
+                    core.request.set_header(ctx, 'X-Userinfo-Detail-'..k,response.user[k])

Review comment:
       ```suggestion
                       core.request.set_header(ctx, 'X-Userinfo-Detail-' .. k, response.user[k])
   ```




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] yaule commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
yaule commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1034421680


   > 
   
   https://grafana.com/docs/grafana/latest/auth/auth-proxy/


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1034582381


   we have `set_userinfo_header` attributes in openid-connect plugin, see: https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/openid-connect.md#attributes
   
   It looks like this feature is already available.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1034395905


   Can you show the relevant docs or issue, I don't understand its usefulness.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on pull request #6270: feat(oidc): add set_userinfo_detail_header

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #6270:
URL: https://github.com/apache/apisix/pull/6270#issuecomment-1039260840


   > Yes, the upstream services do not need base64 decoding user information, they can be obtained directly from X-userinfo-Detail-*
   
   My concern is that this is only grafana usage and is not a universal standard.
   I would like to know if there are more common standards that support this header.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org