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

Parse non-standard groups claim as string csv #2185

Closed
blut opened this issue Jun 23, 2021 · 3 comments
Closed

Parse non-standard groups claim as string csv #2185

blut opened this issue Jun 23, 2021 · 3 comments

Comments

@blut
Copy link

blut commented Jun 23, 2021

Hello

Our upstream ID provider offers groups as claim in the ID Token formatted as groups: "|group1|group2|".
Since groups are parsed as []interface{}, the claim is never found and the string is neither parsed, nor passed to any client.

I'd like to suggest optionally parsing the groups claim as csv with configurable separator e.g. along the lines of

            vs := claims[groupsKey]
            groupsStr, ok := vs.(string)
            if ok {
                for _, v := range strings.Split(groupsStr, c.groupsSep) {
                    if v == "" {
                        continue
                    }
                    groups = append(groups, v)
                }
            }

Ideally, the solution would allow custom parsing for any separate claimMapping.

Is there a preferred way or suggestion how to achieve the desired result?

@sagikazarmark
Copy link
Member

We plan to implement a middleware layer that would allow these kinds of transformations: #1635

What I recommend in the meantime is building a custom version of Dex with a modified connector.

@blut
Copy link
Author

blut commented Jun 23, 2021

Thanks for the info. That's what I'm currently running.
Feel free to close this issue.

@sagikazarmark
Copy link
Member

Closing as we already track this issue.

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

No branches or pull requests

2 participants