From 2cd2e6dd19d94ce39a30b885b3190d337620983f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 9 Dec 2021 16:22:10 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=88=A0=E9=99=A4=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=94=A8=E6=88=B7token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/framework/web/exception/GlobalExceptionHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java index f5e07a013..5981e09e3 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java @@ -3,6 +3,7 @@ package com.ruoyi.framework.web.exception; import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.exception.NotPermissionException; import cn.dev33.satoken.exception.NotRoleException; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.http.HttpStatus; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; @@ -59,7 +60,7 @@ public class GlobalExceptionHandler { public AjaxResult handleAccessDeniedException(NotLoginException e, HttpServletRequest request) { String requestURI = request.getRequestURI(); String token = e.getMessage().split(":")[1]; - RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + token); + StpUtil.kickoutByTokenValue(token); log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage()); return AjaxResult.error(HttpStatus.HTTP_UNAUTHORIZED, StringUtils.format("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI)); }