From 8af85e80663836a2f893be7c6feaefdf92bc93a6 Mon Sep 17 00:00:00 2001 From: MichelleChung <1242874891@qq.com> Date: 星期一, 19 九月 2022 20:30:46 +0800 Subject: [PATCH] !234 【轻量级 PR】使用 `@SaIgnore` 替换 `@Anonymous ` Merge pull request !234 from MichelleChung/dev --- ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java | 18 +++--------------- 1 files changed, 3 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 4c76f1e..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,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.common.utils.spring.SpringUtils; import com.ruoyi.framework.config.properties.ExcludeUrlProperties; import com.ruoyi.framework.config.properties.SecurityProperties; @@ -16,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 閰嶇疆 @@ -38,7 +33,7 @@ @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 @@ -59,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