cryostatio / cryostat

Other
7 stars 8 forks source link

fix(auth): use X-Forwarded-User header to populate username response #490

Closed andrewazores closed 1 month ago

andrewazores commented 1 month ago

Welcome to Cryostat3! 👋

Before contributing, make sure you have:

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Related to #489

Description of the change:

If the X-Forwarded-User header is present in the request, use this to populate the POST /api/v2.1/auth response. This header may be provided to Cryostat by its auth proxy. If there is no such header (there is no proxy, or the proxy doesn't send this) then the empty string is used.

Motivation for the change:

This may allow Cryostat to inform the client of the username that was provided to the auth proxy. In the case of the web-client this can be used to include the user's username in the application UI.

How to manually test:

  1. Not sure at this time. oauth2_proxy docs claim that the X-Forwarded-User header should be passed, but this may not be the case when using alpha configuration? It doesn't seem that it actually gets passed with any proxy configuration I try.
andrewazores commented 1 month ago

@mwangggg @aali309 ping

andrewazores commented 1 month ago

/build_test

github-actions[bot] commented 1 month ago

Workflow started at 6/5/2024, 9:31:47 AM. View Actions Run.

github-actions[bot] commented 1 month ago

No GraphQL schema changes detected.

github-actions[bot] commented 1 month ago

No OpenAPI schema changes detected.

github-actions[bot] commented 1 month ago

CI build and push: All tests pass ✅ (JDK17) https://github.com/cryostatio/cryostat3/actions/runs/9385079539