Use oidc.Verifier to verify tokens

This commit is contained in:
Andy Lindeman
2019-06-20 13:15:59 -04:00
parent 157c359f3e
commit 46f5726d11
4 changed files with 154 additions and 75 deletions

View File

@@ -200,6 +200,16 @@ func TestOAuth2CodeFlow(t *testing.T) {
return nil
},
},
{
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))
if err != nil {
return fmt.Errorf("failed to fetch userinfo: %v", err)
}
return nil
},
},
{
name: "verify id token and oauth2 token expiry",
handleToken: func(ctx context.Context, p *oidc.Provider, config *oauth2.Config, token *oauth2.Token) error {