Skip to content

Commit

Permalink
Update Validator godoc, add additional jwt test case
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlanda committed Feb 6, 2024
1 parent 8c57220 commit 6ee096b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jwt/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import (
const DefaultLeewaySeconds = 150

// Validator validates JSON Web Tokens (JWT) by providing signature
// verification and claims set validation.
// verification and claims set validation. Validator can contain either
// a single or multiple KeySets and will attempt to verify the JWT by iterating
// through the configured KeySets.
type Validator struct {
keySets []KeySet
}
Expand Down
12 changes: 12 additions & 0 deletions jwt/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,18 @@ func TestNewValidator(t *testing.T) {
},
},
},
{
name: "new validator with nil keySet in keySets",
args: args{
keySets: func() []KeySet {
ks, err := NewJSONWebKeySet(context.Background(),
"https://issuer.com/"+wellKnownJWKS, "")
require.NoError(t, err)
return []KeySet{ks, nil}
},
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 6ee096b

Please sign in to comment.