From a714add2de4626b183e2ee83e80ea37e408faa26 Mon Sep 17 00:00:00 2001 From: dsx137 <70027572+dsx137@users.noreply.github.com> Date: Tue, 3 Nov 2026 18:22:59 +0800 Subject: [PATCH] refactor(core): upgrade JWT imports to v5 --- go.mod | 4 ++-- pkg/authverify/token.go | 3 ++- pkg/common/storage/controller/auth.go | 3 ++- test/jwt/main.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 8a968d2b0..5411ea8ab 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/gin-gonic/gin v1.12.0 github.com/go-playground/validator/v10 v10.30.1 github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.2 + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/gorilla/websocket v1.5.1 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/mitchellh/mapstructure v1.5.0 @@ -31,6 +31,7 @@ require ( github.com/gin-contrib/gzip v1.0.1 github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redismock/v9 v9.2.0 + github.com/golang-jwt/jwt/v5 v5.3.1 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/kelindar/bitmap v1.5.2 github.com/likexian/gokit v0.25.13 @@ -104,7 +105,6 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-zookeeper/zk v1.0.4 // indirect github.com/goccy/go-yaml v1.19.2 // indirect - github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go index f1b377bad..45213dacd 100644 --- a/pkg/authverify/token.go +++ b/pkg/authverify/token.go @@ -18,7 +18,8 @@ import ( "context" "fmt" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt/v5" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" diff --git a/pkg/common/storage/controller/auth.go b/pkg/common/storage/controller/auth.go index f9061a73b..2137160e3 100644 --- a/pkg/common/storage/controller/auth.go +++ b/pkg/common/storage/controller/auth.go @@ -3,7 +3,8 @@ package controller import ( "context" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt/v5" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" diff --git a/test/jwt/main.go b/test/jwt/main.go index 0ef845237..701f18435 100644 --- a/test/jwt/main.go +++ b/test/jwt/main.go @@ -17,7 +17,7 @@ package main import ( "fmt" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt/v5" ) func main() {