删除gateway校验token
This commit is contained in:
parent
fb0c57d2b2
commit
6db90e5662
@ -46,19 +46,20 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||||||
if (ObjectUtils.isEmpty(api_token) || ObjectUtils.isEmpty(api_type)) {
|
if (ObjectUtils.isEmpty(api_token) || ObjectUtils.isEmpty(api_type)) {
|
||||||
return Mono.error(new RuntimeException("未登录"));
|
return Mono.error(new RuntimeException("未登录"));
|
||||||
}
|
}
|
||||||
String key = RedisConstans.IOT_TOKEN.concat(api_token);
|
return chain.filter(exchange);
|
||||||
return reactiveRedisTemplate.getExpire(key).map(Duration::getSeconds).flatMap(ttl -> {
|
// String key = RedisConstans.IOT_TOKEN.concat(api_token);
|
||||||
if (ttl == -1) {
|
// return reactiveRedisTemplate.getExpire(key).map(Duration::getSeconds).flatMap(ttl -> {
|
||||||
// 用户没登陆
|
// if (ttl == -1) {
|
||||||
return Mono.error(new RuntimeException("未登录"));
|
// // 用户没登陆
|
||||||
} else if (ttl <= 3600) {
|
// return Mono.error(new RuntimeException("未登录"));
|
||||||
// token 将要失效
|
// } else if (ttl <= 3600) {
|
||||||
return reactiveRedisTemplate.expire(key, Duration.ofDays(7)).then(chain.filter(exchange));
|
// // token 将要失效
|
||||||
} else {
|
// return reactiveRedisTemplate.expire(key, Duration.ofDays(7)).then(chain.filter(exchange));
|
||||||
// 正常登录
|
// } else {
|
||||||
return chain.filter(exchange);
|
// // 正常登录
|
||||||
}
|
// return chain.filter(exchange);
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user