Skip to content

Commit 678262d

Browse files
committed
fix: should not allow kid override by header parameter
1 parent b82da3e commit 678262d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

token/jwt/jwt.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ func (j *DefaultSigner) Generate(ctx context.Context, claims MapClaims, header M
4848

4949
switch t := key.(type) {
5050
case *jose.JSONWebKey:
51+
header.Add("kid", t.KeyID)
5152
return generateToken(claims, header, jose.SignatureAlgorithm(t.Algorithm), t)
5253
case jose.JSONWebKey:
54+
header.Add("kid", t.KeyID)
5355
return generateToken(claims, header, jose.SignatureAlgorithm(t.Algorithm), t)
5456
case *rsa.PrivateKey:
5557
return generateToken(claims, header, jose.RS256, t)

0 commit comments

Comments
 (0)