From 427c83e38fe4fda7217c0c085f398d263869a529 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 30 Oct 2024 23:36:33 +0800 Subject: [PATCH] :bug: Fix read jwt handle claims wrong --- pkg/nex/sec/jwt_reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/nex/sec/jwt_reader.go b/pkg/nex/sec/jwt_reader.go index 03c0d09..bfc4d2b 100644 --- a/pkg/nex/sec/jwt_reader.go +++ b/pkg/nex/sec/jwt_reader.go @@ -41,7 +41,7 @@ func NewJwtReader(fp string) (*JwtReader, error) { func ReadJwt[T jwt.Claims](v *JwtReader, in string) (T, error) { var out T - token, err := jwt.Parse(in, func(token *jwt.Token) (interface{}, error) { + token, err := jwt.ParseWithClaims(in, out, func(token *jwt.Token) (interface{}, error) { if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) }