From f082ca61b94ddfef5276a1e25c284480829d1a79 Mon Sep 17 00:00:00 2001 From: JMY <1960978976qq.com> Date: Fri, 15 Aug 2025 19:05:57 +0800 Subject: [PATCH 1/5] =?UTF-8?q?build(yudao-server):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98=20Java=20SDK=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 io.swagger 的 swagger-annotations 依赖,版本 1.6.6 - 添加 com.github.wechatpay-apiv3 的 wechatpay-java 依赖,版本 0.2.7 --- yudao-server/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index 97ee0daf38..f997dbba8c 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -114,6 +114,18 @@ + + io.swagger + swagger-annotations + 1.6.6 + + + + com.github.wechatpay-apiv3 + wechatpay-java + 0.2.7 + + -- Gitee From 761c8177a087599d41a335b1b72ecf535144634c Mon Sep 17 00:00:00 2001 From: JMY <1960978976qq.com> Date: Fri, 15 Aug 2025 19:35:41 +0800 Subject: [PATCH 2/5] =?UTF-8?q?build(module-system):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20Sa-Token=E4=BE=9D=E8=B5=96=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 yudao-module-system 模块中添加 Sa-Token 依赖,版本为 1.34.0 - 优化 yudao-server 的 pom.xml,注释掉未使用的依赖 - 改进 YudaoWebSecurityConfigurerAdapter 类的安全配置: - 添加跨域配置解释 - 详细注释 CSRF 禁用和会话管理策略 - 增加异常处理和 iframe 嵌入相关配置的注释 - 明确 @PermitAll 注解的扫描和白名单设置 - 添加 Token 拦截器的解释 --- .../YudaoWebSecurityConfigurerAdapter.java | 31 ++++++++++++------- yudao-module-system/pom.xml | 7 ++++- yudao-server/pom.xml | 1 + 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java index bcf78f163b..d03ba88cea 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java @@ -110,19 +110,22 @@ public class YudaoWebSecurityConfigurerAdapter { protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { // 登出 httpSecurity - // 开启跨域 + // 开启跨域 意思是:允许前端网页(比如 http://localhost:3000)访问这个后端(http://localhost:8080) .cors(Customizer.withDefaults()) - // CSRF 禁用,因为不使用 Session + // CSRF 禁用,因为不使用 Session CSRF 是一种老式攻击方式,主要针对“用浏览器登录、靠 Cookie 维持登录状态”的系统。但我们用的是 token(比如 JWT),不是 Session + Cookie,所以可以安全地关掉它。 .csrf(AbstractHttpConfigurer::disable) - // 基于 token 机制,所以不需要 Session + // 基于 token 机制,所以不需要 Session 普通网站登录后,服务器会创建一个“会话”(Session)来记住你。但我们不用这种方式,我们靠 token 来识别用户,所以设置为 STATELESS(无状态),表示“我不记录你是谁,你每次来都要带 token”。 .sessionManagement(c -> c.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + //有些页面需要被其他系统用