mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 11:35:59 +08:00
* feat: Add light mode and dark mode.(#89) Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: make file code len Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: fix scripts support win Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: make build issue Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: golint and format Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: add scripts sudo limits of authority Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: docker images fix Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: docker images fix Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
type Claims struct {
|
||||
UserID string
|
||||
PlatformID int //login platform
|
||||
PlatformID int // login platform
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
@@ -40,10 +40,11 @@ func BuildClaims(uid string, platformID int, ttl int64) Claims {
|
||||
UserID: uid,
|
||||
PlatformID: platformID,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), //Expiration time
|
||||
IssuedAt: jwt.NewNumericDate(now), //Issuing time
|
||||
NotBefore: jwt.NewNumericDate(before), //Begin Effective time
|
||||
}}
|
||||
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), // Expiration time
|
||||
IssuedAt: jwt.NewNumericDate(now), // Issuing time
|
||||
NotBefore: jwt.NewNumericDate(before), // Begin Effective time
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func secret() jwt.Keyfunc {
|
||||
@@ -101,9 +102,11 @@ func CheckAdmin(ctx context.Context) error {
|
||||
func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) {
|
||||
return GetClaimFromToken(string(redisToken.([]uint8)))
|
||||
}
|
||||
|
||||
func IsManagerUserID(opUserID string) bool {
|
||||
return utils.IsContain(opUserID, config.Config.Manager.UserID)
|
||||
}
|
||||
|
||||
func WsVerifyToken(token, userID string, platformID int) error {
|
||||
claim, err := GetClaimFromToken(token)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user