From 574837a92aede1973fdceda0169efd37cff0673d Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期日, 18 九月 2022 22:14:11 +0800
Subject: [PATCH] !229 升级sa-token到最新版1.31.0 Merge pull request !229 from Charles7c/dev

---
 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java
index a07494b..f53dc06 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java
@@ -1,12 +1,12 @@
 package com.ruoyi.framework.config;
 
-import cn.dev33.satoken.interceptor.SaAnnotationInterceptor;
-import cn.dev33.satoken.interceptor.SaRouteInterceptor;
+import cn.dev33.satoken.interceptor.SaInterceptor;
 import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
 import cn.dev33.satoken.router.SaRouter;
 import cn.dev33.satoken.stp.StpLogic;
 import cn.dev33.satoken.stp.StpUtil;
-import com.ruoyi.common.helper.LoginHelper;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.framework.config.properties.ExcludeUrlProperties;
 import com.ruoyi.framework.config.properties.SecurityProperties;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -14,9 +14,6 @@
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 /**
  * sa-token 閰嶇疆
@@ -36,13 +33,15 @@
     @Override
     public void addInterceptors(InterceptorRegistry registry) {
         // 娉ㄥ唽璺敱鎷︽埅鍣紝鑷畾涔夐獙璇佽鍒�
-        registry.addInterceptor(new SaRouteInterceptor((request, response, handler) -> {
+        registry.addInterceptor(new SaInterceptor(handler -> {
+            ExcludeUrlProperties excludeUrlProperties = SpringUtils.getBean(ExcludeUrlProperties.class);
             // 鐧诲綍楠岃瘉 -- 鎺掗櫎澶氫釜璺緞
             SaRouter
                 // 鑾峰彇鎵�鏈夌殑
                 .match("/**")
                 // 鎺掗櫎涓嬩笉闇�瑕佹嫤鎴殑
                 .notMatch(securityProperties.getExcludes())
+                .notMatch(excludeUrlProperties.getExcludes())
                 // 瀵规湭鎺掗櫎鐨勮矾寰勮繘琛屾鏌�
                 .check(() -> {
                     // 妫�鏌ユ槸鍚︾櫥褰� 鏄惁鏈塼oken
@@ -55,14 +54,7 @@
                     // }
 
                 });
-        }) {
-            @SuppressWarnings("all")
-            @Override
-            public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
-                LoginHelper.clearCache();
-            }
-        }).addPathPatterns("/**");
-        registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**");
+        })).addPathPatterns("/**");
     }
 
     @Bean

--
Gitblit v1.9.3