From 6db90e566298bb21b83a80bc1eb432d24d623a19 Mon Sep 17 00:00:00 2001 From: weiyachao <13526234727@126.com> Date: Fri, 20 Oct 2023 17:59:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4gateway=E6=A0=A1=E9=AA=8Ctoke?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qiuguo/iot/gateway/filter/AuthFilter.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/iot-gateway/src/main/java/com/qiuguo/iot/gateway/filter/AuthFilter.java b/iot-gateway/src/main/java/com/qiuguo/iot/gateway/filter/AuthFilter.java index f39604c..43f76f7 100644 --- a/iot-gateway/src/main/java/com/qiuguo/iot/gateway/filter/AuthFilter.java +++ b/iot-gateway/src/main/java/com/qiuguo/iot/gateway/filter/AuthFilter.java @@ -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); + // } + // }); }