Skip to content

Commit bc44de4

Browse files
committed
build: continew-starter 2.13.2-SNAPSHOT => 2.13.2
1.使用 EncryptHelper 重构用户导入相关加密查询场景 2.BCryptEncryptor 适配最新加密体系 3.使用 Jackson JSONUtils 优化 ServletUtils.writeJSON(Hutool JSONUtil 序列化无法识别 Jackson 注解) 4.DefaultDataPermissionUserDataProvider 包调整、UserData、RoleData 字段类型调整 5.其他隐形升级(租户拦截器优先级、依赖升级等)
1 parent 84b2c39 commit bc44de4

15 files changed

Lines changed: 65 additions & 65 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<img src="https://img.shields.io/badge/SNAPSHOT-v4.0.0-%23ff3f59.svg" alt="Release" />
55
</a>
66
<a href="https://github.com/continew-org/continew-starter" title="ContiNew Starter" target="_blank">
7-
<img src="https://img.shields.io/badge/ContiNew Starter-2.13.1-%236CB52D.svg" alt="ContiNew Starter" />
7+
<img src="https://img.shields.io/badge/ContiNew Starter-2.13.2-%236CB52D.svg" alt="ContiNew Starter" />
88
</a>
99
<a href="https://spring.io/projects/spring-boot" title="Spring Boot" target="_blank">
1010
<img src="https://img.shields.io/badge/Spring Boot-3.3.12-%236CB52D.svg?logo=Spring-Boot" alt="Spring Boot" />
@@ -226,7 +226,7 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe
226226
| <a href="https://arco.design/vue/docs/start" target="_blank">Arco Design</a> | 2.57.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 |
227227
| <a href="https://www.typescriptlang.org/zh/" target="_blank">TypeScript</a> | 5.0.4 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 |
228228
| <a href="https://vite.dev/" target="_blank">Vite</a> | 5.1.5 | 下一代的前端工具链,为开发提供极速响应。 |
229-
| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.13.1 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 |
229+
| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.13.2 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 |
230230
| <a href="https://spring.io/projects/spring-boot" target="_blank">Spring Boot</a> | 3.3.12 | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) |
231231
| <a href="https://undertow.io/" target="_blank">Undertow</a> | 2.3.18.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 |
232232
| <a href="https://sa-token.dev33.cn/" target="_blank">Sa-Token + JWT</a> | 1.44.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 |
@@ -248,7 +248,7 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe
248248
| [AJ-Captcha](https://ajcaptcha.beliefteam.cn/captcha-doc/) | 1.3.0 | Java 行为验证码,包含滑动拼图、文字点选两种方式,UI支持弹出和嵌入两种方式。 |
249249
| Easy Captcha | 1.6.2 | Java 图形验证码,支持 gif、中文、算术等类型,可用于 Java Web、JavaSE 等项目。 |
250250
| [Crane4j](https://createsequence.gitee.io/crane4j-doc/#/) | 2.9.0 | 一个基于注解的,用于完成一切 “根据 A 的 key 值拿到 B,再把 B 的属性映射到 A” 这类需求的字段填充框架。 |
251-
| [SpEL Validator](https://spel-validator.sticki.cn/) | 0.5.0-beta | 基于 SpEL 的 jakarta.validation-api 扩展增强包。 |
251+
| [SpEL Validator](https://spel-validator.sticki.cn/) | 0.5.1-beta | 基于 SpEL 的 jakarta.validation-api 扩展增强包。 |
252252
| [CosID](https://cosid.ahoo.me/guide/getting-started.html) | 2.13.0 | 旨在提供通用、灵活、高性能的分布式 ID 生成器。 |
253253
| [Graceful Response](https://doc.feiniaojin.com/graceful-response/home.html) | 5.0.4-boot3 | 一个Spring Boot技术栈下的优雅响应处理组件,可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程,提高开发效率,提高代码质量。 |
254254
| <a href="https://doc.xiaominfo.com/" target="_blank">Knife4j</a> | 4.5.0 | 前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案。 |

‎continew-common/src/main/java/top/continew/admin/common/config/mybatis/BCryptEncryptor.java‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
package top.continew.admin.common.config.mybatis;
1818

1919
import org.springframework.security.crypto.password.PasswordEncoder;
20-
import top.continew.starter.security.crypto.encryptor.IEncryptor;
20+
import top.continew.starter.security.crypto.encryptor.AbstractEncryptor;
21+
import top.continew.starter.security.crypto.encryptor.CryptoContext;
2122
import top.continew.starter.security.password.constant.PasswordEncoderConstants;
2223

2324
/**
@@ -26,16 +27,17 @@
2627
* @author Charles7c
2728
* @since 2024/2/8 22:29
2829
*/
29-
public class BCryptEncryptor implements IEncryptor {
30+
public class BCryptEncryptor extends AbstractEncryptor {
3031

3132
private final PasswordEncoder passwordEncoder;
3233

33-
public BCryptEncryptor(PasswordEncoder passwordEncoder) {
34+
public BCryptEncryptor(CryptoContext context, PasswordEncoder passwordEncoder) {
35+
super(context);
3436
this.passwordEncoder = passwordEncoder;
3537
}
3638

3739
@Override
38-
public String encrypt(String plaintext, String password, String publicKey) {
40+
public String encrypt(String plaintext) {
3941
// 如果已经是 BCrypt 加密格式,直接返回
4042
if (PasswordEncoderConstants.BCRYPT_PATTERN.matcher(plaintext).matches()) {
4143
return plaintext;
@@ -44,7 +46,7 @@ public String encrypt(String plaintext, String password, String publicKey) {
4446
}
4547

4648
@Override
47-
public String decrypt(String ciphertext, String password, String privateKey) {
49+
public String decrypt(String ciphertext) {
4850
return ciphertext;
4951
}
5052
}

‎continew-common/src/main/java/top/continew/admin/common/config/mybatis/DefaultDataPermissionUserDataProvider.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616

1717
package top.continew.admin.common.config.mybatis;
1818

19-
import cn.hutool.core.convert.Convert;
2019
import top.continew.admin.common.context.UserContext;
2120
import top.continew.admin.common.context.UserContextHolder;
2221
import top.continew.starter.core.util.CollUtils;
2322
import top.continew.starter.extension.datapermission.enums.DataScope;
24-
import top.continew.starter.extension.datapermission.filter.DataPermissionUserDataProvider;
2523
import top.continew.starter.extension.datapermission.model.RoleData;
2624
import top.continew.starter.extension.datapermission.model.UserData;
25+
import top.continew.starter.extension.datapermission.provider.DataPermissionUserDataProvider;
2726

2827
/**
2928
* 数据权限用户数据提供者
@@ -42,10 +41,11 @@ public boolean isFilter() {
4241
public UserData getUserData() {
4342
UserContext userContext = UserContextHolder.getContext();
4443
UserData userData = new UserData();
45-
userData.setUserId(Convert.toStr(userContext.getId()));
46-
userData.setDeptId(Convert.toStr(userContext.getDeptId()));
47-
userData.setRoles(CollUtils.mapToSet(userContext.getRoles(), r -> new RoleData(Convert.toStr(r
48-
.getId()), DataScope.valueOf(r.getDataScope().name()))));
44+
userData.setUserId(userContext.getId());
45+
userData.setDeptId(userContext.getDeptId());
46+
userData.setRoles(CollUtils.mapToSet(userContext.getRoles(), r -> new RoleData(r.getId(), DataScope.valueOf(r
47+
.getDataScope()
48+
.name()))));
4949
return userData;
5050
}
5151
}

‎continew-common/src/main/java/top/continew/admin/common/config/mybatis/MybatisPlusConfiguration.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.springframework.context.annotation.Bean;
2323
import org.springframework.context.annotation.Configuration;
2424
import org.springframework.security.crypto.password.PasswordEncoder;
25-
import top.continew.starter.extension.datapermission.filter.DataPermissionUserDataProvider;
25+
import top.continew.starter.extension.datapermission.provider.DataPermissionUserDataProvider;
2626

2727
import java.util.concurrent.TimeUnit;
2828

@@ -62,6 +62,6 @@ public DataPermissionUserDataProvider dataPermissionUserDataProvider() {
6262
*/
6363
@Bean
6464
public BCryptEncryptor bCryptEncryptor(PasswordEncoder passwordEncoder) {
65-
return new BCryptEncryptor(passwordEncoder);
65+
return new BCryptEncryptor(null, passwordEncoder);
6666
}
6767
}

‎continew-common/src/main/java/top/continew/admin/common/util/SecureUtils.java‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,8 @@
1919
import cn.hutool.core.codec.Base64;
2020
import cn.hutool.crypto.SecureUtil;
2121
import cn.hutool.crypto.asymmetric.KeyType;
22-
import cn.hutool.extra.spring.SpringUtil;
2322
import top.continew.admin.common.config.RsaProperties;
24-
import top.continew.starter.core.exception.BusinessException;
25-
import top.continew.starter.core.util.CollUtils;
2623
import top.continew.starter.core.util.validation.ValidationUtils;
27-
import top.continew.starter.security.crypto.autoconfigure.CryptoProperties;
28-
import top.continew.starter.security.crypto.encryptor.AesEncryptor;
29-
import top.continew.starter.security.crypto.encryptor.IEncryptor;
30-
31-
import java.util.List;
3224

3325
/**
3426
* 加密/解密工具类
@@ -86,22 +78,4 @@ public static String encryptByRsaPublicKey(String data, String publicKey) {
8678
public static String decryptByRsaPrivateKey(String data, String privateKey) {
8779
return new String(SecureUtil.rsa(privateKey, null).decrypt(Base64.decode(data), KeyType.PrivateKey));
8880
}
89-
90-
/**
91-
* 对普通加密字段列表进行AES加密,优化starter加密模块后优化这个方法
92-
*
93-
* @param values 待加密内容
94-
* @return 加密后内容
95-
*/
96-
public static List<String> encryptFieldByAes(List<String> values) {
97-
IEncryptor encryptor = new AesEncryptor();
98-
CryptoProperties properties = SpringUtil.getBean(CryptoProperties.class);
99-
return CollUtils.mapToList(values, value -> {
100-
try {
101-
return encryptor.encrypt(value, properties.getPassword(), properties.getPublicKey());
102-
} catch (Exception e) {
103-
throw new BusinessException("字段加密异常");
104-
}
105-
});
106-
}
10781
}

‎continew-server/src/main/java/top/continew/admin/config/satoken/SaExtensionInterceptor.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import top.continew.admin.common.context.UserContextHolder;
2929
import top.continew.starter.core.util.ServletUtils;
3030
import top.continew.starter.extension.tenant.context.TenantContextHolder;
31+
import top.continew.starter.json.jackson.util.JSONUtils;
3132
import top.continew.starter.web.model.R;
3233

3334
/**
@@ -61,7 +62,8 @@ public boolean preHandle(HttpServletRequest request,
6162
Long userTenantId = userContext.getTenantId();
6263
Long tenantId = TenantContextHolder.getTenantId();
6364
if (!userTenantId.equals(tenantId)) {
64-
ServletUtils.writeJSON(response, R.fail(String.valueOf(HttpStatus.FORBIDDEN.value()), "您当前没有访问该租户的权限"));
65+
R r = R.fail(String.valueOf(HttpStatus.FORBIDDEN.value()), "您当前没有访问该租户的权限");
66+
ServletUtils.writeJSON(response, JSONUtils.toJsonStr(r));
6567
return false;
6668
}
6769
}

‎continew-server/src/main/resources/config/application-dev.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ logging:
123123
continew-starter.security:
124124
crypto:
125125
enabled: true
126+
# 默认算法,即 @FieldEncrypt 默认采用的算法(默认:AES 对称加密算法)
127+
algorithm: AES
126128
# 对称加密算法密钥
127129
password: abcdefghijklmnop
128130
# 非对称加密算法密钥(在线生成 RSA 密钥对:http://web.chacuo.net/netrsakeypair)

‎continew-server/src/main/resources/config/application-prod.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ logging:
132132
continew-starter.security:
133133
crypto:
134134
enabled: true
135+
# 默认算法,即 @FieldEncrypt 默认采用的算法(默认:AES 对称加密算法)
136+
algorithm: AES
135137
# 对称加密算法密钥
136138
password: abcdefghijklmnop
137139
# 非对称加密算法密钥(在线生成 RSA 密钥对:http://web.chacuo.net/netrsakeypair)

‎continew-server/src/main/resources/config/application.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ application:
77
description: 持续迭代优化的前后端分离中后台管理系统框架,开箱即用,持续提供舒适的开发体验。
88
# 版本
99
version: 4.0.0-SNAPSHOT
10-
starter: 2.13.1
10+
starter: 2.13.2
1111
# 基本包
1212
base-package: top.continew.admin
1313
## 作者信息配置

‎continew-server/src/main/resources/db/changelog/mysql/main_data.sql‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,16 @@ VALUES
176176
(1, 'admin', '系统管理员', '{bcrypt}$2a$10$4jGwK2BMJ7FgVR.mgwGodey8.xR8FLoU1XSXpxJ9nZQt.pufhasSa', 1, '42190c6c5639d2ca4edb4150a35e058559ccf8270361a23745a2fd285a273c28', '5bda89a4609a65546422ea56bfe5eab4', NULL, '系统初始用户', 1, b'1', NOW(), 1, 1, NOW()),
177177
(547889293968801822, 'test', '测试员', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 2, NULL, NULL, NULL, NULL, 1, b'0', NOW(), 547887852587843593, 1, NOW()),
178178
(547889293968801823, 'Charles', 'Charles', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '代码写到极致,就是艺术。', 1, b'0', NOW(), 547887852587843595, 1, NOW()),
179-
(547889293968801824, 'Yoofff', 'Yoofff', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '弱小和无知不是生存的障碍,傲慢才是。', 1, b'0', NOW(), 1, 1, NOW()),
179+
(547889293968801824, 'Yoofff', 'Yoofff', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '弱小和无知不是生存的障碍,傲慢才是。', 2, b'0', NOW(), 1, 1, NOW()),
180180
(547889293968801825, 'Jasmine', 'Jasmine', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '干就完事了!', 1, b'0', NOW(), 547887852587843605, 1, NOW()),
181181
(547889293968801826, 'AutumnSail', '秋登', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '只有追求完美,才能创造奇迹。', 1, b'0', NOW(), 547887852587843602, 1, NOW()),
182182
(547889293968801827, 'Kils', 'Kils', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '可以摆烂,但不能真的菜。', 1, b'0', NOW(), 547887852587843599, 1, NOW()),
183183
(547889293968801828, 'mochou', '莫愁', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '万事莫愁,皆得所愿。', 1, b'0', NOW(), 547887852587843602, 1, NOW()),
184184
(547889293968801829, 'Jing', 'MS-Jing', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '路虽远,行则将至。', 2, b'0', NOW(), 547887852587843599, 1, NOW()),
185185
(547889293968801830, 'domw', '梓陌', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '胜利是奖赏,挫折是常态。', 1, b'0', NOW(), 547887852587843608, 1, NOW()),
186-
(547889293968801831, 'xtanyu', '小熊', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '不想上班。', 1, b'0', NOW(), 547887852587843611, 1, NOW());
186+
(547889293968801831, 'xtanyu', '小熊', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '不想上班。', 1, b'0', NOW(), 547887852587843611, 1, NOW()),
187+
(547889293968801832, 'luoqiz', '老罗', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '行者无疆,丈量四方。', 1, b'0', NOW(), 1, 1, NOW()),
188+
(547889293968801833, 'lishuyanla', '颜如玉', '{bcrypt}$2a$10$xAsoeMJ.jc/kSxhviLAg7.j2iFrhi6yYAdniNdjLiIUWU/BRZl2Ti', 1, NULL, NULL, NULL, '书中自有颜如玉,世间多是李莫愁。', 1, b'0', NOW(), 1, 1, NOW());
187189

188190
-- 初始化默认参数
189191
INSERT INTO `sys_option`
@@ -246,7 +248,9 @@ VALUES
246248
(8, 547889293968801828, 547888897925840928),
247249
(9, 547889293968801829, 547888897925840928),
248250
(10, 547889293968801830, 547888897925840928),
249-
(11, 547889293968801831, 547888897925840928);
251+
(11, 547889293968801831, 547888897925840928),
252+
(12, 547889293968801832, 547888897925840928),
253+
(13, 547889293968801833, 547888897925840928);
250254

251255
-- 初始化默认角色和菜单关联数据
252256
INSERT INTO `sys_role_menu`

0 commit comments

Comments
 (0)