@@ -50,19 +50,18 @@ type IDTokenVerifier struct {
5050// This constructor can be used to create a verifier directly using the issuer URL and
5151// JSON Web Key Set URL without using discovery:
5252//
53- // keySet := oidc.NewRemoteKeySet(ctx, "https://www.googleapis.com/oauth2/v3/certs")
54- // verifier := oidc.NewVerifier("https://accounts.google.com", keySet, config)
53+ // keySet := oidc.NewRemoteKeySet(ctx, "https://www.googleapis.com/oauth2/v3/certs")
54+ // verifier := oidc.NewVerifier("https://accounts.google.com", keySet, config)
5555//
5656// Since KeySet is an interface, this constructor can also be used to supply custom
5757// public key sources. For example, if a user wanted to supply public keys out-of-band
5858// and hold them statically in-memory:
5959//
60- // // Custom KeySet implementation.
61- // keySet := newStatisKeySet(publicKeys...)
62- //
63- // // Verifier uses the custom KeySet implementation.
64- // verifier := oidc.NewVerifier("https://auth.example.com", keySet, config)
60+ // // Custom KeySet implementation.
61+ // keySet := newStatisKeySet(publicKeys...)
6562//
63+ // // Verifier uses the custom KeySet implementation.
64+ // verifier := oidc.NewVerifier("https://auth.example.com", keySet, config)
6665func NewVerifier (issuerURL string , keySet KeySet , config * Config ) * IDTokenVerifier {
6766 return & IDTokenVerifier {keySet : keySet , config : config , issuer : issuerURL }
6867}
@@ -190,19 +189,18 @@ func parseClaim(raw []byte, name string, v interface{}) error {
190189//
191190// See: https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation
192191//
193- // oauth2Token, err := oauth2Config.Exchange(ctx, r.URL.Query().Get("code"))
194- // if err != nil {
195- // // handle error
196- // }
197- //
198- // // Extract the ID Token from oauth2 token.
199- // rawIDToken, ok := oauth2Token.Extra("id_token").(string)
200- // if !ok {
201- // // handle error
202- // }
192+ // oauth2Token, err := oauth2Config.Exchange(ctx, r.URL.Query().Get("code"))
193+ // if err != nil {
194+ // // handle error
195+ // }
203196//
204- // token, err := verifier.Verify(ctx, rawIDToken)
197+ // // Extract the ID Token from oauth2 token.
198+ // rawIDToken, ok := oauth2Token.Extra("id_token").(string)
199+ // if !ok {
200+ // // handle error
201+ // }
205202//
203+ // token, err := verifier.Verify(ctx, rawIDToken)
206204func (v * IDTokenVerifier ) Verify (ctx context.Context , rawIDToken string ) (* IDToken , error ) {
207205 jws , err := jose .ParseSigned (rawIDToken )
208206 if err != nil {
0 commit comments