add operationID when ws connecting

pull/455/head
skiffer-git 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent d3aa3dbf41
commit 8a5bb7be35

@ -1 +1 @@
Subproject commit 3ecd23203cd6bd746b1fcb0c70755bd2cbf5361c
Subproject commit fd87b4bfc3ee7e9f4c50140b884eb4505d00bc44

@ -271,7 +271,7 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
// e := err.(*constant.ErrInfo)
log.Error(operationID, "Token verify failed ", "query ", query, msg, err.Error())
w.Header().Set("Sec-Websocket-Version", "13")
http.Error(w, err.Error(), 2001)
http.Error(w, err.Error(), status)
return false
} else {
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) {
claims, err := ParseToken(token, "")
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 {
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)) {
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)
return true, nil, ""

Loading…
Cancel
Save