mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 01:50:25 +08:00
API认证超时时增加检查系统时钟提示
This commit is contained in:
@@ -160,7 +160,7 @@ func (this *BaseService) ValidateNodeId(ctx context.Context, roles ...rpcutils.U
|
|||||||
timestamp := m.GetInt64("timestamp")
|
timestamp := m.GetInt64("timestamp")
|
||||||
if time.Now().Unix()-timestamp > 600 {
|
if time.Now().Unix()-timestamp > 600 {
|
||||||
// 请求超过10分钟认为超时
|
// 请求超过10分钟认为超时
|
||||||
return rpcutils.UserTypeNone, 0, errors.New("authenticate timeout")
|
return rpcutils.UserTypeNone, 0, errors.New("authenticate timeout, please check your system clock")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch apiToken.Role {
|
switch apiToken.Role {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ func ValidateRequest(ctx context.Context, userTypes ...UserType) (userType UserT
|
|||||||
timestamp := m.GetInt64("timestamp")
|
timestamp := m.GetInt64("timestamp")
|
||||||
if time.Now().Unix()-timestamp > 600 {
|
if time.Now().Unix()-timestamp > 600 {
|
||||||
// 请求超过10分钟认为超时
|
// 请求超过10分钟认为超时
|
||||||
return UserTypeNone, 0, errors.New("authenticate timeout")
|
return UserTypeNone, 0, errors.New("authenticate timeout, please check your system clock")
|
||||||
}
|
}
|
||||||
|
|
||||||
t := m.GetString("type")
|
t := m.GetString("type")
|
||||||
|
|||||||
Reference in New Issue
Block a user