Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add UserInfo endpoint#1473

Merged
srenatus merged 11 commits into
dexidp:masterfrom
alindeman:add-user-endpoint
Jul 2, 2019
Merged

Add UserInfo endpoint#1473
srenatus merged 11 commits into
dexidp:masterfrom
alindeman:add-user-endpoint

Conversation

@alindeman
Copy link
Copy Markdown
Contributor

This PR takes the great work in #1454, reworks it a bit to lean on oidc.Verifier for verification, and adds tests.

Fixes #376
Closes #1133
Closes #1201
Closes #1453
Closes #1454

@alindeman alindeman force-pushed the add-user-endpoint branch from 7592623 to 7970903 Compare June 20, 2019 17:30
@alindeman
Copy link
Copy Markdown
Contributor Author

/cc @srenatus @mdbraber @lstoll for review

@srenatus
Copy link
Copy Markdown
Contributor

I'll review this next week. Thanks for contributing! 😃 🎉

Comment thread server/handlers.go Outdated
@alindeman alindeman force-pushed the add-user-endpoint branch from 7970903 to 46f5726 Compare June 22, 2019 17:18
Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

🎉 It's nice to see this come together, thanks for contributing. Some nitpicks/questions inside 😃

Comment thread server/handlers.go
}
rawIDToken := auth[len(prefix):]

verifier := oidc.NewVerifier(s.issuerURL.String(), &storageKeySet{s.storage}, &oidc.Config{SkipClientIDCheck: true})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this a costly operation? (I.e., do we want to store and re-use oidc.NewVerifier? (I have no idea, genuine question.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not, as far as I can tell. The implementation is currently:

func NewVerifier(issuerURL string, keySet KeySet, config *Config) *IDTokenVerifier {
	return &IDTokenVerifier{keySet: keySet, config: config, issuer: issuerURL}
}

Somewhat notably, constructing an oidc.Provider is a relatively expensive operation, but we don't have a need to do that in non-test code.

Comment thread server/handlers.go Outdated
Comment thread server/oauth2.go Outdated
Comment thread server/server_test.go Outdated
{
name: "fetch userinfo",
handleToken: func(ctx context.Context, p *oidc.Provider, config *oauth2.Config, token *oauth2.Token) error {
_, err := p.UserInfo(ctx, config.TokenSource(ctx, token))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❓ Would it be worthwhile to assert something on the response?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went back and forth on it. Not many of the other tests do, but since it ended up being easy enough, I've added something in 840065f. Let me know what you think.

@alindeman
Copy link
Copy Markdown
Contributor Author

🎉 It's nice to see this come together, thanks for contributing. Some nitpicks/questions inside 😃

@srenatus Thanks for the review. Let me know if you'd like to see anything else addressed.

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

😃 LGTM, one question plus another nitpick. @JoelSpeed @ericchiang What do you think?

Comment thread go.mod
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292 // indirect
github.com/coreos/etcd v3.2.9+incompatible
github.com/coreos/go-oidc v0.0.0-20170307191026-be73733bb8cc
github.com/coreos/go-oidc v2.0.0+incompatible
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❓Is this a problem somehow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it mostly means this repository uses a v2 tag, but not in the native go mod way. In fact, it's not been converted to a go module yet at all (therefore incompatible).

I'm personally not concerned about it: it's pretty standard fare while the Go community converts things slowly to modules over time. If/when go-oidc becomes a module, we might have to update some imports, but otherwise shouldn't be a big deal.

Comment thread server/handlers.go
Auth string `json:"authorization_endpoint"`
Token string `json:"token_endpoint"`
Keys string `json:"jwks_uri"`
UserInfo string `json:"userinfo_endpoint"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you expand this test case for the discovery json, please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. Done, 59b6595

Comment thread server/handlers.go
@alindeman
Copy link
Copy Markdown
Contributor Author

Any reviewers have any additional feedback or requests to change things?

Copy link
Copy Markdown
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

I've had a read through and this seems sensible, happy with it if @srenatus is happy all his comments are resolved?

@srenatus
Copy link
Copy Markdown
Contributor

srenatus commented Jul 1, 2019

If no one beats me to it, I'll merge this tomorrow and push a release tag

lstoll pushed a commit to pardot/deci that referenced this pull request Jul 1, 2019
lstoll pushed a commit to pardot/deci that referenced this pull request Jul 1, 2019
lstoll pushed a commit to pardot/deci that referenced this pull request Jul 1, 2019
@srenatus
Copy link
Copy Markdown
Contributor

srenatus commented Jul 2, 2019

I've considered another round-trip with the @alindeman for squashing commits, but... I don't think it matters that much. I'm going to push the big green button. 🚀

@srenatus srenatus merged commit 8b4dbb9 into dexidp:master Jul 2, 2019
@mdbraber
Copy link
Copy Markdown
Contributor

mdbraber commented Jul 2, 2019

@srenatus @alindeman @jackielii @JoelSpeed thanks for all the work getting this implemented!

mmrath pushed a commit to mmrath/dex that referenced this pull request Sep 2, 2019
clubanderson added a commit to kubestellar/console-kb that referenced this pull request Apr 3, 2026
Replace wrong PR dexidp/dex#766 (implicit/hybrid flow) with the
actual fix dexidp/dex#1473 (Add UserInfo endpoint). Update resolution
text to describe the UserInfo endpoint feature.

Signed-off-by: Andrew Anderson <[email protected]>
clubanderson added a commit to kubestellar/console-kb that referenced this pull request Apr 3, 2026
Replace wrong PR dexidp/dex#766 (implicit/hybrid flow) with the
actual fix dexidp/dex#1473 (Add UserInfo endpoint). Update resolution
text to describe the UserInfo endpoint feature.

Signed-off-by: Andrew Anderson <[email protected]>
clubanderson added a commit to kubestellar/console-kb that referenced this pull request Apr 3, 2026
* 🌱 Add dex: UserInfo endpoint mission

* 🌱 Add dex: UserInfo endpoint mission

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix dex #376 mission: correct PR to #1473 (UserInfo endpoint)

Replace wrong PR dexidp/dex#766 (implicit/hybrid flow) with the
actual fix dexidp/dex#1473 (Add UserInfo endpoint). Update resolution
text to describe the UserInfo endpoint feature.

Signed-off-by: Andrew Anderson <[email protected]>

---------

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Andrew Anderson <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

UserInfo endpoint

5 participants