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

Allow adding fields from user info #44

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MartinWallgren
Copy link

This change makes it possible to extract extra fields form user info to the generated token.

For example, to have upn from the Azure token be added to the final JWT, we can add the below to the oauth config section.

extract upn from userinfo

This PR is an attempt to solve this greenpau/caddy-security#190

This change makes it possible to extract extra fields form user info to
the generated token.

For example, to have `upn` from the Azure token be added to the final
JWT, we can add the below to the oauth config section.

    extract upn from userinfo
@MartinWallgren
Copy link
Author

@greenpau any feedback on this?
This is a real problem for most that are using AzureAD.
I don't mind implementing something else if you don't agree with this solution.

@greenpau
Copy link
Owner

This is a real problem for most that are using AzureAD.

@MartinWallgren , I do not have time to look at this at the moment. The idea sounds good. Just need to find some time to do maintenance of the plugin. Please ping me again if it is not merged by the end of august.

m := make(map[string]interface{})
for k, v := range claims {
if _, exists := b.userInfoFields[k]; exists {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinWallgren , thank you for the contribution. What is the effect of this? Is it possible to only add "select" fields as opposed to everything?

@greenpau greenpau self-requested a review December 2, 2023 14:14
@greenpau greenpau marked this pull request as draft December 2, 2023 14:20
@greenpau
Copy link
Owner

thank you for the contribution. What is the effect of this? Is it possible to only add "select" fields as opposed to everything?

@MartinWallgren , please see ^

@raffaeleguidi
Copy link

hi, any plan on adding this to a release?

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