|
|
@@ -89,20 +89,20 @@ public class Oauth2Filter implements GlobalFilter, Ordered {
|
|
|
String mapJson = stringRedisTemplate.opsForValue().get("REDIS_USER_LOGIN_" + userId + "_" + appCode);
|
|
|
Map<String, Object> userMap = JSON.parseObject(mapJson);
|
|
|
String token = "Bearer " + userMap.get("accessToken");
|
|
|
- if (accessToken.equals(token) ) {
|
|
|
- //定义响应体
|
|
|
- JSONObject result = new JSONObject() {{
|
|
|
- put("code", ErrorCodeEnum.USER_TOKEN_EXPIRE.getCode());
|
|
|
- put("message", ErrorCodeEnum.USER_TOKEN_EXPIRE.getMessage());
|
|
|
- put("data", "");
|
|
|
- }};
|
|
|
- //作JSON转换
|
|
|
- byte[] bytes = JSON.toJSONString(result).getBytes(StandardCharsets.UTF_8);
|
|
|
- //调用bufferFactory方法,生成DataBuffer对象
|
|
|
- DataBuffer buffer = response.bufferFactory().wrap(bytes);
|
|
|
- //调用Mono中的just方法,返回要写给前端的JSON数据
|
|
|
- return response.writeWith(Mono.just(buffer));
|
|
|
- }
|
|
|
+// if (accessToken.equals(token) ) {
|
|
|
+// //定义响应体
|
|
|
+// JSONObject result = new JSONObject() {{
|
|
|
+// put("code", ErrorCodeEnum.USER_TOKEN_EXPIRE.getCode());
|
|
|
+// put("message", ErrorCodeEnum.USER_TOKEN_EXPIRE.getMessage());
|
|
|
+// put("data", "");
|
|
|
+// }};
|
|
|
+// //作JSON转换
|
|
|
+// byte[] bytes = JSON.toJSONString(result).getBytes(StandardCharsets.UTF_8);
|
|
|
+// //调用bufferFactory方法,生成DataBuffer对象
|
|
|
+// DataBuffer buffer = response.bufferFactory().wrap(bytes);
|
|
|
+// //调用Mono中的just方法,返回要写给前端的JSON数据
|
|
|
+// return response.writeWith(Mono.just(buffer));
|
|
|
+// }
|
|
|
} catch (Exception e) {
|
|
|
return chain.filter(exchange);
|
|
|
}
|