From ac9e3f2ca4d2255739f8b60165f5b51b31ccd3e6 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期五, 13 一月 2023 23:04:08 +0800
Subject: [PATCH] update 适配 springdoc 新版本配置方式

---
 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java |   22 +++++-----------------
 1 files changed, 5 insertions(+), 17 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..2912286 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,10 @@
 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.framework.config.properties.SecurityProperties;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -14,9 +12,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 +31,11 @@
     @Override
     public void addInterceptors(InterceptorRegistry registry) {
         // 娉ㄥ唽璺敱鎷︽埅鍣紝鑷畾涔夐獙璇佽鍒�
-        registry.addInterceptor(new SaRouteInterceptor((request, response, handler) -> {
+        registry.addInterceptor(new SaInterceptor(handler -> {
             // 鐧诲綍楠岃瘉 -- 鎺掗櫎澶氫釜璺緞
             SaRouter
                 // 鑾峰彇鎵�鏈夌殑
                 .match("/**")
-                // 鎺掗櫎涓嬩笉闇�瑕佹嫤鎴殑
-                .notMatch(securityProperties.getExcludes())
                 // 瀵规湭鎺掗櫎鐨勮矾寰勮繘琛屾鏌�
                 .check(() -> {
                     // 妫�鏌ユ槸鍚︾櫥褰� 鏄惁鏈塼oken
@@ -55,14 +48,9 @@
                     // }
 
                 });
-        }) {
-            @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("/**")
+            // 鎺掗櫎涓嶉渶瑕佹嫤鎴殑璺緞
+            .excludePathPatterns(securityProperties.getExcludes());
     }
 
     @Bean

--
Gitblit v1.9.3