mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 03:25:59 +08:00
add operationID when ws connecting
This commit is contained in:
committed by
Xinwei Xiong(cubxxw-openim)
parent
d3aa3dbf41
commit
8a5bb7be35
+1
-1
Submodule cmd/Open-IM-SDK-Core updated: 3ecd23203c...fd87b4bfc3
@@ -271,7 +271,7 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
// e := err.(*constant.ErrInfo)
|
// e := err.(*constant.ErrInfo)
|
||||||
log.Error(operationID, "Token verify failed ", "query ", query, msg, err.Error())
|
log.Error(operationID, "Token verify failed ", "query ", query, msg, err.Error())
|
||||||
w.Header().Set("Sec-Websocket-Version", "13")
|
w.Header().Set("Sec-Websocket-Version", "13")
|
||||||
http.Error(w, err.Error(), 2001)
|
http.Error(w, err.Error(), status)
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
log.Info(operationID, "Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
log.Info(operationID, "Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
||||||
|
|||||||
@@ -218,13 +218,13 @@ func VerifyToken(token, uid string) (bool, error) {
|
|||||||
func WsVerifyToken(token, uid string, platformID string) (bool, error, string) {
|
func WsVerifyToken(token, uid string, platformID string) (bool, error, string) {
|
||||||
claims, err := ParseToken(token, "")
|
claims, err := ParseToken(token, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, utils.Wrap(err, ""), "parse token err"
|
return false, utils.Wrap(err, "parse token err"), "parse token err"
|
||||||
}
|
}
|
||||||
if claims.UID != uid {
|
if claims.UID != uid {
|
||||||
return false, utils.Wrap(&constant.ErrTokenUnknown, ""), "uid is not same to token uid"
|
return false, utils.Wrap(&constant.ErrTokenUnknown, "uid is not same to token uid"), "uid is not same to token uid"
|
||||||
}
|
}
|
||||||
if claims.Platform != constant.PlatformIDToName(utils.StringToInt32(platformID)) {
|
if claims.Platform != constant.PlatformIDToName(utils.StringToInt32(platformID)) {
|
||||||
return false, utils.Wrap(&constant.ErrTokenUnknown, ""), "platform is not same to token platform"
|
return false, utils.Wrap(&constant.ErrTokenUnknown, "platform is not same to token platform"), "platform is not same to token platform"
|
||||||
}
|
}
|
||||||
log.NewDebug("", claims.UID, claims.Platform)
|
log.NewDebug("", claims.UID, claims.Platform)
|
||||||
return true, nil, ""
|
return true, nil, ""
|
||||||
|
|||||||
Reference in New Issue
Block a user