Skip to content

Commit c797a55

Browse files
authored
Merge pull request coreos#145 from ericchiang/cleanups-and-testing
*: various cleanups and improved unit testing
2 parents 5157aa7 + 9e2f6d9 commit c797a55

File tree

10 files changed

+445
-968
lines changed

10 files changed

+445
-968
lines changed

example/idtoken/app.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ func main() {
2828
log.Fatal(err)
2929
}
3030
oidcConfig := &oidc.Config{
31-
ClientID: clientID,
32-
SkipNonceCheck: true,
31+
ClientID: clientID,
3332
}
3433
verifier := provider.Verifier(oidcConfig)
3534

example/nonce/app.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package main
55

66
import (
77
"encoding/json"
8-
"errors"
98
"log"
109
"net/http"
1110
"os"
@@ -23,13 +22,6 @@ var (
2322

2423
const appNonce = "a super secret nonce"
2524

26-
func ClaimNonce(nonce string) error {
27-
if nonce != appNonce {
28-
return errors.New("unregonized nonce")
29-
}
30-
return nil
31-
}
32-
3325
func main() {
3426
ctx := context.Background()
3527

@@ -39,8 +31,7 @@ func main() {
3931
}
4032

4133
oidcConfig := &oidc.Config{
42-
ClientID: clientID,
43-
ClaimNonce: ClaimNonce,
34+
ClientID: clientID,
4435
}
4536
// Use the nonce source to create a custom ID Token verifier.
4637
nonceEnabledVerifier := provider.Verifier(oidcConfig)
@@ -82,6 +73,10 @@ func main() {
8273
http.Error(w, "Failed to verify ID Token: "+err.Error(), http.StatusInternalServerError)
8374
return
8475
}
76+
if idToken.Nonce != appNonce {
77+
http.Error(w, "Invalid ID Token nonce", http.StatusInternalServerError)
78+
return
79+
}
8580

8681
resp := struct {
8782
OAuth2Token *oauth2.Token

gen.go

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)