Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send configured claims as headers to backends #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bennesp
Copy link

@bennesp bennesp commented Sep 2, 2022

This PR add the possibility to configure generic claims to be passed to backends as headers.

It is related to this comment #64 (comment) which is by far the most upvoted comment in this repository

Just as an example: if you set EXTRA_CLAIMS = "x-forwarded-locale:locale, x-forwarded-picture:picture" then your backends will receive two new headers: X-Forwarded-Locale, containing the value inside the locale claim, and X-Forwarded-Picture, containing the value inside the claim picture

Note: remember also to add authResponseHeaders or authResponseHeadersRegex to your middleware appropriately of course

@thmo
Copy link

thmo commented Feb 14, 2023

This really looks useful - could you provide a build of it, maybe in your fork?

@bennesp
Copy link
Author

bennesp commented Feb 14, 2023

Sure, here it is: ghcr.io/bennesp/traefik-forward-auth:v3.1.0-pr72. It is built by Github Actions

@thmo
Copy link

thmo commented Feb 25, 2023

Thx!

@dleske
Copy link

dleske commented Mar 31, 2023

Is there something holding this back (apart from devs' time of course)? So far as I can tell this would be the only way for me to receive claims about authenticated users from the identity providers--I am releasing information from the providers but can only get the username (e-mail) to my application.

@bennesp
Copy link
Author

bennesp commented Apr 1, 2023

So far as I can tell this would be the only way for me to receive claims about authenticated users from the identity providers

I don’t think this is totally true. I recall a configuration variable (I think it was called FORWARD_TOKEN_HEADER_NAME) that you can use to choose the header where to receive the whole JWT in the backend.

Then, of course, your backend needs to decode the JWT, but after that (even without verifying it, if you trust the network) you will be able to access any claim defined in the JWT.

This of course doesn't prevent this PR to be reviewed and merged 😅

@thmo
Copy link

thmo commented Aug 30, 2024

Would love to see this one merged...

@bennesp
Copy link
Author

bennesp commented Sep 5, 2024

I considered this fork as unmaintained since I didn't see any new commits from 2022, but then in August I saw @mhrabovcin working on merging some PRs.

Maybe he can give a shot to this PR too? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants