|
|
|
@ -156,11 +156,11 @@ func ParseToken(tokensString, operationID string) (claims *Claims, err error) {
|
|
|
|
|
m, err := commonDB.DB.GetTokenMapByUidPid(claims.UID, claims.Platform)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(operationID, "get token from redis err", err.Error(), tokensString)
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenInvalid, "")
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenInvalid, "get token from redis err")
|
|
|
|
|
}
|
|
|
|
|
if m == nil {
|
|
|
|
|
log.NewError(operationID, "get token from redis err", "m is nil", tokensString)
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenInvalid, "")
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenInvalid, "get token from redis err")
|
|
|
|
|
}
|
|
|
|
|
if v, ok := m[tokensString]; ok {
|
|
|
|
|
switch v {
|
|
|
|
@ -171,7 +171,7 @@ func ParseToken(tokensString, operationID string) (claims *Claims, err error) {
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenInvalid, "")
|
|
|
|
|
case constant.KickedToken:
|
|
|
|
|
log.Error(operationID, "this token has been kicked by other same terminal ", constant.ErrTokenKicked)
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenKicked, "")
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenKicked, "this token has been kicked by other same terminal ")
|
|
|
|
|
case constant.ExpiredToken:
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenExpired, "")
|
|
|
|
|
default:
|
|
|
|
@ -179,7 +179,7 @@ func ParseToken(tokensString, operationID string) (claims *Claims, err error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.NewError(operationID, "redis token map not find", constant.ErrTokenUnknown)
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenUnknown, "")
|
|
|
|
|
return nil, utils.Wrap(&constant.ErrTokenUnknown, "redis token map not find")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//func MakeTheTokenInvalid(currentClaims *Claims, platformClass string) (bool, error) {
|
|
|
|
|