Skip to content

feat: allow storing extra oauth token properties in the database #10152

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

Merged
merged 9 commits into from
Oct 9, 2023

Conversation

kylecarbs
Copy link
Member

@kylecarbs kylecarbs commented Oct 9, 2023

Supersedes #10151

These will be accessible via the new external-auth command in #10052

@kylecarbs kylecarbs requested a review from Emyrk October 9, 2023 21:43
@kylecarbs kylecarbs self-assigned this Oct 9, 2023
Comment on lines +293 to +297
extra := map[string]interface{}{}
require.NoError(t, json.Unmarshal(updated.OAuthExtra.RawMessage, &extra))
mapping, ok := extra["authed_user"].(map[string]interface{})
require.True(t, ok)
require.Equal(t, updated.OAuthAccessToken, mapping["access_token"])
Copy link
Member

Choose a reason for hiding this comment

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

This is 100% ok.

I am thinking of maybe exposing an easy way to hit the IDP with a Bearer token that would essentially do this check. The /userinfo will validate an access token for the request, but oauth2 is a subset of OIDC and does not have an easy UserInfo method to call from the token/config.

Just would be a nice helper to have like fake.UserInfo(accessToken string) or something convenient. Maybe 🤔

@kylecarbs kylecarbs merged commit 863c2e7 into main Oct 9, 2023
@kylecarbs kylecarbs deleted the extraprovider branch October 9, 2023 23:49
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants