bugfix
This commit is contained in:
@@ -155,6 +155,15 @@ func setupSetting() error {
|
||||
if global.JWTSetting == nil || global.JWTSetting.SecretKey == "" {
|
||||
return fmt.Errorf("JWT secret key must not be empty")
|
||||
}
|
||||
// 过期时间必须为正数,这里 fail-fast 不静默兜底:
|
||||
// 配 0 会让签出的 token 立即过期(登录即失败),且 TTL=0 传给 Redis 表示「不设过期」,
|
||||
// 会话 key 会永久驻留、无法自然回收。
|
||||
if global.JWTSetting.AccessTokenExpire <= 0 {
|
||||
return fmt.Errorf("JWT AccessTokenExpire must be > 0, got %d", global.JWTSetting.AccessTokenExpire)
|
||||
}
|
||||
if global.JWTSetting.RefreshTokenExpire <= 0 {
|
||||
return fmt.Errorf("JWT RefreshTokenExpire must be > 0, got %d", global.JWTSetting.RefreshTokenExpire)
|
||||
}
|
||||
|
||||
err = setting.ReadSection("Cos", &global.CosSetting)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user