From fb7e5348888b58edf18e7d237ceb59eab8c32aa2 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 3 Sep 2024 14:53:29 +0800 Subject: [PATCH] Update main.go --- auth/jwt/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/auth/jwt/main.go b/auth/jwt/main.go index a4f9f97..bccab6b 100644 --- a/auth/jwt/main.go +++ b/auth/jwt/main.go @@ -9,7 +9,7 @@ import ( "github.com/go-kratos/kratos/v2/middleware/auth/jwt" "github.com/go-kratos/kratos/v2/transport/grpc" "github.com/go-kratos/kratos/v2/transport/http" - jwtv4 "github.com/golang-jwt/jwt/v4" + jwtv5 "github.com/golang-jwt/jwt/v5" ) type server struct { @@ -27,7 +27,7 @@ func main() { httpSrv := http.NewServer( http.Address(":8000"), http.Middleware( - jwt.Server(func(token *jwtv4.Token) (interface{}, error) { + jwt.Server(func(token *jwtv5.Token) (interface{}, error) { return []byte(testKey), nil }), ), @@ -35,7 +35,7 @@ func main() { grpcSrv := grpc.NewServer( grpc.Address(":9000"), grpc.Middleware( - jwt.Server(func(token *jwtv4.Token) (interface{}, error) { + jwt.Server(func(token *jwtv5.Token) (interface{}, error) { return []byte(testKey), nil }), ), @@ -45,7 +45,7 @@ func main() { context.Background(), grpc.WithEndpoint("dns:///127.0.0.1:9001"), grpc.WithMiddleware( - jwt.Client(func(token *jwtv4.Token) (interface{}, error) { + jwt.Client(func(token *jwtv5.Token) (interface{}, error) { return []byte(serviceTestKey), nil }), ),