mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 删除异常用户token
This commit is contained in:
		@@ -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<Void> 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));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user