diff --git a/pkg/common/storage/cache/redis/token.go b/pkg/common/storage/cache/redis/token.go index 998b4f1c95..510da43e35 100644 --- a/pkg/common/storage/cache/redis/token.go +++ b/pkg/common/storage/cache/redis/token.go @@ -2,13 +2,14 @@ package redis import ( "context" + "strconv" + "sync" + "time" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/tools/errs" "github.com/redis/go-redis/v9" - "strconv" - "sync" - "time" ) type tokenCache struct { @@ -99,7 +100,7 @@ func (c *tokenCache) SetTokenMapByUidPid(ctx context.Context, userID string, pla return errs.Wrap(c.rdb.HSet(ctx, cachekey.GetTokenKey(userID, platformID), mm).Err()) } -func (c *tokenCache) BatchSetTokenMapByUidPid(ctx context.Context, tokens map[string]map[string]int) error { +func (c *tokenCache) BatchSetTokenMapByUidPid(ctx context.Context, tokens map[string]map[string]any) error { pipe := c.rdb.Pipeline() for k, v := range tokens { pipe.HSet(ctx, k, v) diff --git a/pkg/common/storage/cache/token.go b/pkg/common/storage/cache/token.go index ee0004d7f8..e5e0a93831 100644 --- a/pkg/common/storage/cache/token.go +++ b/pkg/common/storage/cache/token.go @@ -11,6 +11,6 @@ type TokenModel interface { GetTokensWithoutError(ctx context.Context, userID string, platformID int) (map[string]int, error) GetAllTokensWithoutError(ctx context.Context, userID string) (map[int]map[string]int, error) SetTokenMapByUidPid(ctx context.Context, userID string, platformID int, m map[string]int) error - BatchSetTokenMapByUidPid(ctx context.Context, tokens map[string]map[string]int) error + BatchSetTokenMapByUidPid(ctx context.Context, tokens map[string]map[string]any) error DeleteTokenByUidPid(ctx context.Context, userID string, platformID int, fields []string) error } diff --git a/pkg/common/storage/controller/auth.go b/pkg/common/storage/controller/auth.go index 0a70296627..2885b985a5 100644 --- a/pkg/common/storage/controller/auth.go +++ b/pkg/common/storage/controller/auth.go @@ -2,6 +2,7 @@ package controller import ( "context" + "github.com/golang-jwt/jwt/v4" "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/config" @@ -56,7 +57,7 @@ func (a *authDatabase) SetTokenMapByUidPid(ctx context.Context, userID string, p } func (a *authDatabase) BatchSetTokenMapByUidPid(ctx context.Context, tokens []string) error { - setMap := make(map[string]map[string]int) + setMap := make(map[string]map[string]any) for _, token := range tokens { claims, err := tokenverify.GetClaimFromToken(token, authverify.Secret(a.accessSecret)) key := cachekey.GetTokenKey(claims.UserID, claims.PlatformID) @@ -66,7 +67,7 @@ func (a *authDatabase) BatchSetTokenMapByUidPid(ctx context.Context, tokens []st if v, ok := setMap[key]; ok { v[token] = constant.KickedToken } else { - setMap[key] = map[string]int{ + setMap[key] = map[string]any{ token: constant.KickedToken, } }