Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
songzhibin97 committed Sep 3, 2024
1 parent 10de3f1 commit fb7e534
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth/jwt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,15 +27,15 @@ 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
}),
),
)
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
}),
),
Expand All @@ -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
}),
),
Expand Down

0 comments on commit fb7e534

Please sign in to comment.