Merge branch 'feature-BOX一期' of http://47.99.132.106:10081/wulin/qiuguo-iot into feature-BOX一期
This commit is contained in:
commit
ac23efe3a0
@ -46,19 +46,20 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
||||
if (ObjectUtils.isEmpty(api_token) || ObjectUtils.isEmpty(api_type)) {
|
||||
return Mono.error(new RuntimeException("未登录"));
|
||||
}
|
||||
String key = RedisConstans.IOT_TOKEN.concat(api_token);
|
||||
return reactiveRedisTemplate.getExpire(key).map(Duration::getSeconds).flatMap(ttl -> {
|
||||
if (ttl == -1) {
|
||||
// 用户没登陆
|
||||
return Mono.error(new RuntimeException("未登录"));
|
||||
} else if (ttl <= 3600) {
|
||||
// token 将要失效
|
||||
return reactiveRedisTemplate.expire(key, Duration.ofDays(7)).then(chain.filter(exchange));
|
||||
} else {
|
||||
// 正常登录
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
});
|
||||
return chain.filter(exchange);
|
||||
// String key = RedisConstans.IOT_TOKEN.concat(api_token);
|
||||
// return reactiveRedisTemplate.getExpire(key).map(Duration::getSeconds).flatMap(ttl -> {
|
||||
// if (ttl == -1) {
|
||||
// // 用户没登陆
|
||||
// return Mono.error(new RuntimeException("未登录"));
|
||||
// } else if (ttl <= 3600) {
|
||||
// // token 将要失效
|
||||
// return reactiveRedisTemplate.expire(key, Duration.ofDays(7)).then(chain.filter(exchange));
|
||||
// } else {
|
||||
// // 正常登录
|
||||
// return chain.filter(exchange);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user