From 17f0c20242c6ee3d35b9ee8f677d747ed012423c Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 02 九月 2022 16:30:20 +0800 Subject: [PATCH] remove 移除maven docker插件 过于老旧功能缺陷大 使用idea自带的docker插件替代 --- ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java | 42 +++++++++++++++++++----------------------- 1 files changed, 19 insertions(+), 23 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 0459818..a5be267 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 @@ -2,11 +2,12 @@ import cn.dev33.satoken.interceptor.SaAnnotationInterceptor; import cn.dev33.satoken.interceptor.SaRouteInterceptor; -import cn.dev33.satoken.jwt.StpLogicJwtForStyle; +import cn.dev33.satoken.jwt.StpLogicJwtForSimple; import cn.dev33.satoken.router.SaRouter; import cn.dev33.satoken.stp.StpLogic; -import com.ruoyi.common.helper.LoginHelper; -import com.ruoyi.common.utils.StringUtils; +import cn.dev33.satoken.stp.StpUtil; +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 +15,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 閰嶇疆 @@ -37,36 +35,34 @@ public void addInterceptors(InterceptorRegistry registry) { // 娉ㄥ唽璺敱鎷︽埅鍣紝鑷畾涔夐獙璇佽鍒� registry.addInterceptor(new SaRouteInterceptor((request, response, handler) -> { + ExcludeUrlProperties excludeUrlProperties = SpringUtils.getBean(ExcludeUrlProperties.class); // 鐧诲綍楠岃瘉 -- 鎺掗櫎澶氫釜璺緞 SaRouter // 鑾峰彇鎵�鏈夌殑 .match("/**") // 鎺掗櫎涓嬩笉闇�瑕佹嫤鎴殑 .notMatch(securityProperties.getExcludes()) + .notMatch(excludeUrlProperties.getExcludes()) + // 瀵规湭鎺掗櫎鐨勮矾寰勮繘琛屾鏌� .check(() -> { - Long userId = LoginHelper.getUserId(); - if (StringUtils.isNotNull(userId)) { - // 鏈夋晥鐜囧奖鍝� 鐢ㄤ簬涓存椂娴嬭瘯 - // if (log.isDebugEnabled()) { - // log.debug("鍓╀綑鏈夋晥鏃堕棿: {}", StpUtil.getTokenTimeout()); - // log.debug("涓存椂鏈夋晥鏃堕棿: {}", StpUtil.getTokenActivityTimeout()); - // } - } + // 妫�鏌ユ槸鍚︾櫥褰� 鏄惁鏈塼oken + StpUtil.checkLogin(); + + // 鏈夋晥鐜囧奖鍝� 鐢ㄤ簬涓存椂娴嬭瘯 + // if (log.isDebugEnabled()) { + // log.debug("鍓╀綑鏈夋晥鏃堕棿: {}", StpUtil.getTokenTimeout()); + // log.debug("涓存椂鏈夋晥鏃堕棿: {}", StpUtil.getTokenActivityTimeout()); + // } + }); - }) { - @SuppressWarnings("all") - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - LoginHelper.clearCache(); - } - }).addPathPatterns("/**"); + })).addPathPatterns("/**"); registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**"); } @Bean public StpLogic getStpLogicJwt() { - // Sa-Token 鏁村悎 jwt (Style妯″紡) - return new StpLogicJwtForStyle(); + // Sa-Token 鏁村悎 jwt (绠�鍗曟ā寮�) + return new StpLogicJwtForSimple(); } } -- Gitblit v1.9.3