Commit 840065fa authored by Andy Lindeman's avatar Andy Lindeman

Assert something about the returned userinfo

parent 46f5726d
......@@ -203,10 +203,13 @@ func TestOAuth2CodeFlow(t *testing.T) {
{
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))
ui, err := p.UserInfo(ctx, config.TokenSource(ctx, token))
if err != nil {
return fmt.Errorf("failed to fetch userinfo: %v", err)
}
if conn.Identity.Email != ui.Email {
return fmt.Errorf("expected email to be %v, got %v", conn.Identity.Email, ui.Email)
}
return nil
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment