Skip to content

Commit 012a151

Browse files
committed
fix tests and instantiate
1 parent 1378353 commit 012a151

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
9393
}
9494

9595
switch have := got.(type) {
96-
case VerificationKeySet:
96+
case VerificationKeySet[VerificationKey]:
9797
if len(have.Keys) == 0 {
9898
return token, newError("keyfunc returned empty verification key set", ErrTokenUnverifiable)
9999
}

parser_test.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,26 @@ var (
3030
nilKeyFunc jwt.Keyfunc = nil
3131
multipleZeroKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return []interface{}{}, nil }
3232
multipleEmptyKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) {
33-
return jwt.VerificationKeySet{Keys: []jwt.VerificationKey{nil, nil}}, nil
33+
keys := []jwt.VerificationKey{nil, nil}
34+
return jwt.VerificationKeySet[jwt.VerificationKey]{Keys: keys}, nil
3435
}
3536
multipleVerificationKeysFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) {
3637
return []jwt.VerificationKey{jwtTestDefaultKey, jwtTestEC256PublicKey}, nil
3738
}
3839
multipleLastKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) {
39-
return jwt.VerificationKeySet{Keys: []jwt.VerificationKey{jwtTestEC256PublicKey, jwtTestDefaultKey}}, nil
40+
keys := []jwt.VerificationKey{jwtTestEC256PublicKey, jwtTestDefaultKey}
41+
return jwt.VerificationKeySet[jwt.VerificationKey]{Keys: keys}, nil
4042
}
4143
multipleFirstKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) {
42-
return jwt.VerificationKeySet{Keys: []jwt.VerificationKey{jwtTestDefaultKey, jwtTestEC256PublicKey}}, nil
44+
keys := []jwt.VerificationKey{jwtTestDefaultKey, jwtTestEC256PublicKey}
45+
return jwt.VerificationKeySet[jwt.VerificationKey]{Keys: keys}, nil
4346
}
4447
multipleAltTypedKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) {
45-
return jwt.VerificationKeySet{Keys: []jwt.VerificationKey{jwtTestDefaultKey, jwtTestDefaultKey}}, nil
48+
keys := []jwt.VerificationKey{jwtTestDefaultKey, jwtTestDefaultKey}
49+
return jwt.VerificationKeySet[jwt.VerificationKey]{Keys: keys}, nil
4650
}
4751
emptyVerificationKeySetFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) {
48-
return jwt.VerificationKeySet{}, nil
52+
return jwt.VerificationKeySet[jwt.VerificationKey]{}, nil
4953
}
5054
)
5155

0 commit comments

Comments
 (0)