mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-23 18:00:32 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
This commit is contained in:
commit
e98d17b1b7
@ -89,5 +89,15 @@ func IsManagerUserID(opUserID string) bool {
|
|||||||
return utils.IsContain(opUserID, config.Config.Manager.AppManagerUid)
|
return utils.IsContain(opUserID, config.Config.Manager.AppManagerUid)
|
||||||
}
|
}
|
||||||
func WsVerifyToken(token, userID, platformID string) error {
|
func WsVerifyToken(token, userID, platformID string) error {
|
||||||
|
claim, err := GetClaimFromToken(token)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if claim.UID != userID {
|
||||||
|
return errs.ErrTokenInvalid.Wrap(fmt.Sprintf("token uid %s != userID %s", claim.UID, userID))
|
||||||
|
}
|
||||||
|
if claim.Platform != platformID {
|
||||||
|
return errs.ErrInternalServer.Wrap(fmt.Sprintf("token platform %s != platformID %s", claim.Platform, platformID))
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user