🎉 4.1.0.RELEASE 登录认证升级为国密算法,数据库password字段内容无需变动

This commit is contained in:
smallchill 2024-07-14 23:40:58 +08:00
parent 31b94c25d1
commit c3165e2ed6
88 changed files with 284 additions and 245 deletions

199
README.md
View File

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/Release-V4.0.0-green.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Release-V4.1.0-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-17+-green.svg" alt="Build Status"> <img src="https://img.shields.io/badge/JDK-17+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status"> <img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-2023-blue.svg" alt="Coverage Status"> <img src="https://img.shields.io/badge/Spring%20Cloud-2023-blue.svg" alt="Coverage Status">
@ -18,15 +18,28 @@
* [BladeTool](https://github.com/chillzhuang/blade-tool)已推送至Maven中央库直接引入即可减少了工程的臃肿也可更注重于业务开发 * [BladeTool](https://github.com/chillzhuang/blade-tool)已推送至Maven中央库直接引入即可减少了工程的臃肿也可更注重于业务开发
* 集成Sentinel从流量控制、熔断降级、系统负载等多个维度保护服务的稳定性。 * 集成Sentinel从流量控制、熔断降级、系统负载等多个维度保护服务的稳定性。
* 注册中心、配置中心选型Nacos为工程瘦身的同时加强各模块之间的联动。 * 注册中心、配置中心选型Nacos为工程瘦身的同时加强各模块之间的联动。
* 使用Traefik进行反向代理监听后台变化自动化应用新的配置文件。
* 极简封装了多租户底层用更少的代码换来拓展性更强的SaaS多租户系统。 * 极简封装了多租户底层用更少的代码换来拓展性更强的SaaS多租户系统。
* 借鉴OAuth2实现了多终端认证系统可控制子系统的token权限互相隔离。 * 借鉴OAuth2自研多终端认证系统可控制子系统的token权限互相隔离。
* 借鉴Security封装了Secure模块采用JWT做Token认证可拓展集成Redis等细颗粒度控制方案。 * 借鉴Security自研Secure模块采用JWT做Token认证可拓展集成Redis等细颗粒度控制方案。
* 稳定生产了三年,经历了从 Camden -> Hoxton -> 2021 的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构。 * 稳定生产了六年,经历了从 Camden -> Hoxton -> 2023 的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构。
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。 * 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
## 架构图 ## 架构图
<img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-framework.png"/> <img src="https://xbladex.oss-cn-hangzhou.aliyuncs.com/upload/springblade-framework.png"/>
## 核心技术栈
| 技术栈 | 版本 |
|----------------------|------------|
| Java | 17+ |
| NodeJS | 18+ |
| Spring | 6.1.10 |
| Spring Boot | 3.2.7 |
| Spring Cloud | 2023.0.2 |
| Spring Cloud Alibaba | 2023.0.1.0 |
| Nacos Alibaba | 2.3.2 |
| Mybatis Plus | 3.5.7 |
## 工程结构 ## 工程结构
``` ```
@ -53,40 +66,68 @@ SpringBlade
``` ```
## 官方信息 ## 官方信息
* 官网地址:[https://bladex.cn](https://bladex.cn)
* 问答社区:[https://sns.bladex.cn](https://sns.bladex.cn)
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
* 交流一群:`477853168`(满)
* 交流二群:`751253339`(满)
* 交流三群:`784729540`(满)
* 交流四群:`1034621754`(满)
* 交流五群:`946350912`(满)
* 交流六群:`511624269`(满)
* 交流七群:`298061704`
## 在线演示 | 简介 | 内容 |
* Saber-基于Vue[https://saber.bladex.cn](https://saber.bladex.cn) |------|-------------------------------------------------------------------------------|
* Sword-基于React[https://sword.bladex.cn](https://sword.bladex.cn) | 官网地址 | [https://bladex.cn](https://bladex.cn) |
| 问答社区 | [https://sns.bladex.cn](https://sns.bladex.cn) |
| 会员计划 | [SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) |
| 交流一群 | `477853168` (满) |
| 交流二群 | `751253339` (满) |
| 交流三群 | `784729540` (满) |
| 交流四群 | `1034621754` (满) |
| 交流五群 | `946350912` (满) |
| 交流六群 | `511624269` (满) |
| 交流七群 | `298061704` |
## 数据大屏 ## 官方产品
* 数据大屏展示系统:[https://data.bladex.cn](https://data.bladex.cn)
| 简介 | 演示地址 |
|---------------|------------------------------------------------------|
| BladeX企业级开发平台 | [https://saber3.bladex.cn](https://saber3.bladex.cn) |
| BladeX可视化数据大屏 | [https://data.bladex.cn](https://data.bladex.cn) |
| BladeX物联网开发平台 | [https://iot.bladex.cn](https://iot.bladex.cn) |
## 前端项目
| 简介 | 地址 |
|--------------------|----------------------------------------------------------------------------------------------------|
| 前端框架Sword(基于React) | [https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword) |
| 前端框架Saber(基于Vue2) | [https://gitee.com/smallc/Saber](https://gitee.com/smallc/Saber) |
| 前端框架Saber3(基于Vue3) | [https://gitee.com/smallc/Saber3](https://gitee.com/smallc/Saber/tree/3.x/) |
## 后端项目
| 简介 | 地址 |
|---------------|----------------------------------------------------------------------------------------------------|
| 核心框架项目地址 | [https://gitee.com/smallc/blade-tool](https://gitee.com/smallc/blade-tool) |
| 后端Gitee地址 | [https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade) |
| 后端Github地址 | [https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade) |
| 后端SpringBoot版 | [https://gitee.com/smallc/SpringBlade/tree/boot/](https://gitee.com/smallc/SpringBlade/tree/boot/) |
## 安全手册
| 简介 | 地址 |
|-----------|----------------------------------------------------------------------------------------------------|
| Blade安全手册 | [https://www.kancloud.cn/smallchill/blade-safety](https://www.kancloud.cn/smallchill/blade-safety) |
## 技术文档 ## 技术文档
* [SpringBlade开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)
* [SpringBlade常见问题集锦](https://sns.bladex.cn/article-14966.html)
* [SpringBlade基于Kuboard部署K8S](https://kuboard.cn/learning/k8s-practice/spring-blade/)
* [SpringBlade基于Rainbond部署](https://www.rainbond.com/docs/micro-service/example/blade)
## 项目地址 | 简介 | 地址 |
* 核心框架项目地址:[https://gitee.com/smallc/blade-tool](https://gitee.com/smallc/blade-tool) |---------------------------|--------------------------------------------------------------------------------------------------------------------------|
* 后端Gitee地址[https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade) | SpringBlade开发手册一览 | [https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册) |
* 后端Github地址[https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade) | SpringBlade常见问题集锦 | [https://sns.bladex.cn/article-14966.html](https://sns.bladex.cn/article-14966.html) |
* 后端SpringBoot版[https://gitee.com/smallc/SpringBlade/tree/boot/](https://gitee.com/smallc/SpringBlade/tree/boot/) | SpringBlade基于Kuboard部署K8S | [https://kuboard.cn/learning/k8s-practice/spring-blade/](https://kuboard.cn/learning/k8s-practice/spring-blade/) |
* 前端框架Sword(基于React)[https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword) | SpringBlade基于Rainbond部署 | [https://www.rainbond.com/docs/micro-service/example/blade](https://www.rainbond.com/docs/micro-service/example/blade) |
* 前端框架Saber(基于Vue2)[https://gitee.com/smallc/Saber](https://gitee.com/smallc/Saber)
* 前端框架Saber3(基于Vue3)[https://gitee.com/smallc/Saber3](https://gitee.com/smallc/Saber/tree/3.x/)
# 开源协议
## 免费公开课
<table>
<tr>
<td><a href="https://space.bilibili.com/525525/channel/seriesdetail?sid=2740449" target="_blank"><img style="width: 300px; height: 170px" src="https://xbladex.oss-cn-hangzhou.aliyuncs.com/upload/springblade-course.jpg"/></a></td>
<td><img style="width: 300px; height: 170px" src="https://xbladex.oss-cn-hangzhou.aliyuncs.com/upload/springblade-bilibili.jpg"/></td>
</tr>
</table>
## 开源协议
Apache Licence 2.0 [英文原文](http://www.apache.org/licenses/LICENSE-2.0.html) Apache Licence 2.0 [英文原文](http://www.apache.org/licenses/LICENSE-2.0.html)
Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似同样鼓励代码共享和尊重原作者的著作权同样允许代码修改再发布作为开源或商业软件 Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似同样鼓励代码共享和尊重原作者的著作权同样允许代码修改再发布作为开源或商业软件
需要满足的条件如下: 需要满足的条件如下:
@ -94,95 +135,9 @@ Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议
* 如果你修改了代码,需要在被修改的文件中说明。 * 如果你修改了代码,需要在被修改的文件中说明。
* 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。 * 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。
* 如果再发布的产品中包含一个Notice文件则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可但不可以表现为对Apache Licence构成更改。 * 如果再发布的产品中包含一个Notice文件则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可但不可以表现为对Apache Licence构成更改。
Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。 Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。
## 用户权益 ## 用户权益
* 允许免费用于学习、毕设、公司项目、私活等,但请保留源码作者信息。 * 允许免费用于学习、毕设、公司项目、私活等,但请保留源码作者信息。
* 对未经过授权和不遵循 Apache 2.0 协议二次开源或者商业化我们将追究到底。 * 对未经过授权和不遵循 Apache 2.0 协议二次开源或者商业化我们将追究到底。
* 参考请注明:参考自 SpringBladehttps://gitee.com/smallc/SpringBlade。 * 参考请注明:参考自 SpringBladehttps://gitee.com/smallc/SpringBlade。
# 界面
## [BladeX](https://bladex.cn/#/vip) 工作流一览
<table>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/bladex-flow1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/bladex-flow2.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/bladex-flow3.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/bladex-flow4.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/bladex-flow5.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/bladex-flow6.png"/></td>
</tr>
</table>
## [Sword](https://gitee.com/smallc/Sword) 界面一览
<table>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-main.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-menu.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-menu-edit.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-menu-icon.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-role.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-user.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-dict.png "/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-log.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-locale-cn.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-locale-us.png"/></td>
</tr>
</table>
## [Saber](https://gitee.com/smallc/Saber) 界面一览
<table>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-user.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-role.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-dict.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-dict-select.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-log.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-code.png"/></td>
</tr>
</table>
## 监控界面一览
<table>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-k8s1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-k8s2.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-grafana.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-harbor.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-traefik.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-traefik-health.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-nacos.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-sentinel.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-admin1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-admin2.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-swagger1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-swagger2.png"/></td>
</tr>
</table>

View File

@ -8,7 +8,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<artifactId>blade-auth</artifactId> <artifactId>blade-auth</artifactId>

View File

@ -16,9 +16,9 @@
package org.springblade.auth.controller; package org.springblade.auth.controller;
import com.wf.captcha.SpecCaptcha; import com.wf.captcha.SpecCaptcha;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.auth.granter.ITokenGranter; import org.springblade.auth.granter.ITokenGranter;
import org.springblade.auth.granter.TokenGranterBuilder; import org.springblade.auth.granter.TokenGranterBuilder;
@ -54,11 +54,11 @@ public class AuthController {
@PostMapping("token") @PostMapping("token")
@Operation(summary = "获取认证token", description = "传入租户ID:tenantId,账号:account,密码:password") @Operation(summary = "获取认证token", description = "传入租户ID:tenantId,账号:account,密码:password")
public R<AuthInfo> token(@Parameter(name = "授权类型", required = true) @RequestParam(defaultValue = "password", required = false) String grantType, public R<AuthInfo> token(@Parameter(description = "授权类型", required = true) @RequestParam(defaultValue = "password", required = false) String grantType,
@Parameter(name = "刷新令牌") @RequestParam(required = false) String refreshToken, @Parameter(description = "刷新令牌") @RequestParam(required = false) String refreshToken,
@Parameter(name = "租户ID", required = true) @RequestParam(defaultValue = "000000", required = false) String tenantId, @Parameter(description = "租户ID", required = true) @RequestParam(defaultValue = "000000", required = false) String tenantId,
@Parameter(name = "账号") @RequestParam(required = false) String account, @Parameter(description = "账号") @RequestParam(required = false) String account,
@Parameter(name = "密码") @RequestParam(required = false) String password) { @Parameter(description = "密码") @RequestParam(required = false) String password) {
String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), TokenUtil.DEFAULT_USER_TYPE); String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), TokenUtil.DEFAULT_USER_TYPE);
@ -92,4 +92,11 @@ public class AuthController {
return R.data(Kv.init().set("key", key).set("image", specCaptcha.toBase64())); return R.data(Kv.init().set("key", key).set("image", specCaptcha.toBase64()));
} }
@PostMapping("/logout")
@Operation(summary = "登出")
public R<Kv> logout() {
// 登出预留逻辑
return R.data(Kv.init().set("code", "200").set("msg", "操作成功"));
}
} }

View File

@ -20,6 +20,7 @@ import org.springblade.auth.enums.BladeUserEnum;
import org.springblade.auth.utils.TokenUtil; import org.springblade.auth.utils.TokenUtil;
import org.springblade.common.cache.CacheNames; import org.springblade.common.cache.CacheNames;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.props.BladeAuthProperties;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.user.entity.UserInfo; import org.springblade.system.user.entity.UserInfo;
@ -42,6 +43,8 @@ public class CaptchaTokenGranter implements ITokenGranter {
private IUserClient userClient; private IUserClient userClient;
private RedisUtil redisUtil; private RedisUtil redisUtil;
private BladeAuthProperties authProperties;
@Override @Override
public UserInfo grant(TokenParameter tokenParameter) { public UserInfo grant(TokenParameter tokenParameter) {
HttpServletRequest request = WebUtil.getRequest(); HttpServletRequest request = WebUtil.getRequest();
@ -62,14 +65,17 @@ public class CaptchaTokenGranter implements ITokenGranter {
if (Func.isNoneBlank(account, password)) { if (Func.isNoneBlank(account, password)) {
// 获取用户类型 // 获取用户类型
String userType = tokenParameter.getArgs().getStr("userType"); String userType = tokenParameter.getArgs().getStr("userType");
// 解密密码
String decryptPassword = TokenUtil.decryptPassword(password, authProperties.getPublicKey(), authProperties.getPrivateKey());
// 定义返回结果
R<UserInfo> result; R<UserInfo> result;
// 根据不同用户类型调用对应的接口返回数据用户可自行拓展 // 根据不同用户类型调用对应的接口返回数据用户可自行拓展
if (userType.equals(BladeUserEnum.WEB.getName())) { if (userType.equals(BladeUserEnum.WEB.getName())) {
result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else if (userType.equals(BladeUserEnum.APP.getName())) { } else if (userType.equals(BladeUserEnum.APP.getName())) {
result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else { } else {
result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} }
userInfo = result.isSuccess() ? result.getData() : null; userInfo = result.isSuccess() ? result.getData() : null;
} }

View File

@ -17,6 +17,8 @@ package org.springblade.auth.granter;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.auth.enums.BladeUserEnum; import org.springblade.auth.enums.BladeUserEnum;
import org.springblade.auth.utils.TokenUtil;
import org.springblade.core.secure.props.BladeAuthProperties;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DigestUtil; import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -37,6 +39,8 @@ public class PasswordTokenGranter implements ITokenGranter {
private IUserClient userClient; private IUserClient userClient;
private BladeAuthProperties authProperties;
@Override @Override
public UserInfo grant(TokenParameter tokenParameter) { public UserInfo grant(TokenParameter tokenParameter) {
String tenantId = tokenParameter.getArgs().getStr("tenantId"); String tenantId = tokenParameter.getArgs().getStr("tenantId");
@ -46,14 +50,17 @@ public class PasswordTokenGranter implements ITokenGranter {
if (Func.isNoneBlank(account, password)) { if (Func.isNoneBlank(account, password)) {
// 获取用户类型 // 获取用户类型
String userType = tokenParameter.getArgs().getStr("userType"); String userType = tokenParameter.getArgs().getStr("userType");
// 解密密码
String decryptPassword = TokenUtil.decryptPassword(password, authProperties.getPublicKey(), authProperties.getPrivateKey());
// 定义返回结果
R<UserInfo> result; R<UserInfo> result;
// 根据不同用户类型调用对应的接口返回数据用户可自行拓展 // 根据不同用户类型调用对应的接口返回数据用户可自行拓展
if (userType.equals(BladeUserEnum.WEB.getName())) { if (userType.equals(BladeUserEnum.WEB.getName())) {
result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else if (userType.equals(BladeUserEnum.APP.getName())) { } else if (userType.equals(BladeUserEnum.APP.getName())) {
result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} else { } else {
result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(decryptPassword));
} }
userInfo = result.isSuccess() ? result.getData() : null; userInfo = result.isSuccess() ? result.getData() : null;
} }

View File

@ -20,6 +20,9 @@ import org.springblade.core.secure.AuthInfo;
import org.springblade.core.secure.TokenInfo; import org.springblade.core.secure.TokenInfo;
import org.springblade.core.secure.utils.SecureUtil; import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SM2Util;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo; import org.springblade.system.user.entity.UserInfo;
@ -43,7 +46,8 @@ public class TokenUtil {
public final static String USER_NOT_FOUND = "用户名或密码错误"; public final static String USER_NOT_FOUND = "用户名或密码错误";
public final static String HEADER_KEY = "Authorization"; public final static String HEADER_KEY = "Authorization";
public final static String HEADER_PREFIX = "Basic "; public final static String HEADER_PREFIX = "Basic ";
public final static String DEFAULT_AVATAR = "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"; public final static String ENCRYPT_PREFIX = "04";
public final static String DEFAULT_AVATAR = "https://bladex.cn/images/logo.png";
/** /**
* 创建认证token * 创建认证token
@ -97,4 +101,31 @@ public class TokenUtil {
return SecureUtil.createJWT(param, "audience", "issuser", TokenConstant.REFRESH_TOKEN); return SecureUtil.createJWT(param, "audience", "issuser", TokenConstant.REFRESH_TOKEN);
} }
/**
* 解析国密sm2加密密码
*
* @param rawPassword 请求时提交的原密码
* @param publicKey 公钥
* @param privateKey 私钥
* @return 解密后的密码
*/
public static String decryptPassword(String rawPassword, String publicKey, String privateKey) {
// 其中有空则匹配失败
if (StringUtil.isAnyBlank(publicKey, privateKey)) {
return StringPool.EMPTY;
}
// 处理部分工具类加密不带04前缀的情况
if (!StringUtil.startsWithIgnoreCase(rawPassword, ENCRYPT_PREFIX)) {
rawPassword = ENCRYPT_PREFIX + rawPassword;
}
// 解密密码
String decryptPassword = SM2Util.decrypt(rawPassword, privateKey);
// 签名校验
boolean isVerified = SM2Util.verify(decryptPassword, SM2Util.sign(decryptPassword, privateKey), publicKey);
if (!isVerified) {
return StringPool.EMPTY;
}
return decryptPassword;
}
} }

View File

@ -1,23 +0,0 @@
package org.springblade.test;
import org.springblade.core.tool.utils.AesUtil;
/**
* aesKey生成器
*
* @author Chill
*/
public class AesKeyGenerator {
public static void main(String[] args) {
System.out.println("=======================================================");
for (int i = 0; i < 10; i++) {
String aesKey = AesUtil.genAesKey();
System.out.println("SpringBlade AesKey[" + aesKey + "] ");
}
System.out.println("=======================================================");
System.out.println("====== blade.token.aes-key 的值从中挑选一个便可 =========");
System.out.println("=======================================================");
}
}

View File

@ -1,5 +1,6 @@
package org.springblade.test; package org.springblade.test;
import org.springblade.core.tool.utils.AesUtil;
import org.springblade.core.tool.utils.RandomType; import org.springblade.core.tool.utils.RandomType;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
@ -11,13 +12,12 @@ import org.springblade.core.tool.utils.StringUtil;
public class SignKeyGenerator { public class SignKeyGenerator {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("======================================================="); System.out.println("=========== blade.token.sign-key 配置如下 ==============");
for (int i = 0; i < 10; i++) { System.out.println("#blade配置\n" +
String signKey = StringUtil.random(32, RandomType.ALL); "blade:\n" +
System.out.println("SpringBlade SignKey[" + signKey + "] "); " token:\n" +
} " sign-key: " + StringUtil.random(32, RandomType.ALL) +"\n" +
System.out.println("======================================================="); " aes-key: " + AesUtil.genAesKey() );
System.out.println("====== blade.token.sign-key 的值从中挑选一个便可 =========");
System.out.println("======================================================="); System.out.println("=======================================================");
} }

View File

@ -0,0 +1,46 @@
package org.springblade.test;
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import org.bouncycastle.util.encoders.Hex;
import org.springblade.core.tool.utils.SM2Util;
import org.springblade.core.tool.utils.StringPool;
/**
* signKey生成器
*
* @author Chill
*/
public class Sm2KeyGenerator {
public static void main(String[] args) {
System.out.println("================ blade.auth 配置如下 =================");
AsymmetricCipherKeyPair keyPair = SM2Util.generateKeyPair();
String publicKey = SM2Util.getPublicKeyString(keyPair);
String privateKey = SM2Util.getPrivateKeyString(keyPair);
System.out.println("#blade配置 \n" +
"blade:\n" +
" auth:\n" +
" public-key: " + publicKey + "\n" +
" private-key: " + privateKey);
System.out.println("=======================================================");
System.out.println(StringPool.EMPTY);
System.out.println("============== saber website.js 配置如下 ===============");
System.out.println("//saber配置\n" +
"auth: {\n" +
" publicKey: '" + publicKey + "',\n" +
"}");
System.out.println("=======================================================");
System.out.println(StringPool.EMPTY);
System.out.println("============== 密码:[admin] 加密流程如下 ================");
String password = "admin";
byte[] encryptedData = SM2Util.encrypt(password, publicKey);
String decryptedText = SM2Util.decrypt(encryptedData, privateKey);
System.out.println("加密前: " + password);
System.out.println("加密后: " + Hex.toHexString(encryptedData));
System.out.println("解密后: " + decryptedText);
System.out.println("请注意: 此密文为前端加密后调用token接口的密码参数");
System.out.println("=======================================================");
}
}

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -103,7 +103,7 @@ public class CodeController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(codeService.removeByIds(Func.toLongList(ids))); return R.status(codeService.removeByIds(Func.toLongList(ids)));
} }
@ -113,7 +113,7 @@ public class CodeController extends BladeController {
@PostMapping("/copy") @PostMapping("/copy")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@Operation(summary = "复制", description = "传入id") @Operation(summary = "复制", description = "传入id")
public R copy(@Parameter(name = "主键", required = true) @RequestParam Long id) { public R copy(@Parameter(description = "主键", required = true) @RequestParam Long id) {
Code code = codeService.getById(id); Code code = codeService.getById(id);
code.setId(null); code.setId(null);
code.setCodeName(code.getCodeName() + "-copy"); code.setCodeName(code.getCodeName() + "-copy");
@ -126,7 +126,7 @@ public class CodeController extends BladeController {
@PostMapping("/gen-code") @PostMapping("/gen-code")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "代码生成", description = "传入ids") @Operation(summary = "代码生成", description = "传入ids")
public R genCode(@Parameter(name = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) { public R genCode(@Parameter(description = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) {
Collection<Code> codes = codeService.listByIds(Func.toLongList(ids)); Collection<Code> codes = codeService.listByIds(Func.toLongList(ids));
codes.forEach(code -> { codes.forEach(code -> {
BladeCodeGenerator generator = new BladeCodeGenerator(); BladeCodeGenerator generator = new BladeCodeGenerator();

View File

@ -106,7 +106,7 @@ public class DatasourceController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(datasourceService.deleteLogic(Func.toLongList(ids))); return R.status(datasourceService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -159,7 +159,7 @@ public class $!{table.controllerName} {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids))); return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
} }
@ -171,7 +171,7 @@ public class $!{table.controllerName} {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids))); return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
} }

View File

@ -159,7 +159,7 @@ public class $!{table.controllerName} {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids))); return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
} }
@ -171,7 +171,7 @@ public class $!{table.controllerName} {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids))); return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,13 +5,13 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>4.0.0</version> <version>4.1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>blade-admin</module> <module>blade-admin</module>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,13 +5,13 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>4.0.0</version> <version>4.1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description> <description>SpringBlade 微服务API集合</description>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -111,7 +111,7 @@ public class NoticeController extends BladeController implements CacheNames {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "逻辑删除", description = "传入notice") @Operation(summary = "逻辑删除", description = "传入notice")
public R remove(@Parameter(name = "主键集合") @RequestParam String ids) { public R remove(@Parameter(description = "主键集合") @RequestParam String ids) {
boolean temp = noticeService.deleteLogic(Func.toLongList(ids)); boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
return R.status(temp); return R.status(temp);
} }

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -114,7 +114,7 @@ public class NoticeController extends BladeController implements CacheNames {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "逻辑删除", description = "传入notice") @Operation(summary = "逻辑删除", description = "传入notice")
public R remove(@Parameter(name = "主键集合") @RequestParam String ids) { public R remove(@Parameter(description = "主键集合") @RequestParam String ids) {
boolean temp = noticeService.deleteLogic(Func.toLongList(ids)); boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
return R.status(temp); return R.status(temp);
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -109,7 +109,7 @@ public class AuthClientController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(clientService.deleteLogic(Func.toLongList(ids))); return R.status(clientService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -112,7 +112,7 @@ public class DataScopeController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(SYS_CACHE); CacheUtil.clear(SYS_CACHE);
return R.status(dataScopeService.deleteLogic(Func.toLongList(ids))); return R.status(dataScopeService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -109,7 +109,7 @@ public class DeptController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(deptService.removeByIds(Func.toLongList(ids))); return R.status(deptService.removeByIds(Func.toLongList(ids)));
} }

View File

@ -111,7 +111,7 @@ public class DictController extends BladeController {
@CacheEvict(cacheNames = {DICT_LIST, DICT_VALUE}, allEntries = true) @CacheEvict(cacheNames = {DICT_LIST, DICT_VALUE}, allEntries = true)
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(dictService.removeByIds(Func.toLongList(ids))); return R.status(dictService.removeByIds(Func.toLongList(ids)));
} }

View File

@ -135,7 +135,7 @@ public class MenuController extends BladeController {
@PreAuth(RoleConstant.HAS_ROLE_ADMIN) @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toLongList(ids))); return R.status(menuService.removeByIds(Func.toLongList(ids)));
} }

View File

@ -96,7 +96,7 @@ public class ParamController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(paramService.deleteLogic(Func.toLongList(ids))); return R.status(paramService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -123,7 +123,7 @@ public class PostController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(postService.deleteLogic(Func.toLongList(ids))); return R.status(postService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -141,7 +141,7 @@ public class RegionController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@Operation(summary = "删除", description = "传入主键") @Operation(summary = "删除", description = "传入主键")
public R remove(@Parameter(name = "主键", required = true) @RequestParam String id) { public R remove(@Parameter(description = "主键", required = true) @RequestParam String id) {
return R.status(regionService.removeRegion(id)); return R.status(regionService.removeRegion(id));
} }

View File

@ -128,7 +128,7 @@ public class RoleController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "删除", description = "传入ids") @Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(SYS_CACHE); CacheUtil.clear(SYS_CACHE);
return R.status(roleService.removeByIds(Func.toLongList(ids))); return R.status(roleService.removeByIds(Func.toLongList(ids)));
} }

View File

@ -118,7 +118,7 @@ public class TenantController extends BladeController {
*/ */
@PostMapping("/remove") @PostMapping("/remove")
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(name = "主键集合", required = true) @RequestParam String ids) { public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.deleteLogic(Func.toLongList(ids))); return R.status(tenantService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -149,8 +149,8 @@ public class UserController {
@PostMapping("/grant") @PostMapping("/grant")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operation(summary = "权限设置", description = "传入roleId集合以及menuId集合") @Operation(summary = "权限设置", description = "传入roleId集合以及menuId集合")
public R grant(@Parameter(name = "userId集合", required = true) @RequestParam String userIds, public R grant(@Parameter(description = "userId集合", required = true) @RequestParam String userIds,
@Parameter(name = "roleId集合", required = true) @RequestParam String roleIds) { @Parameter(description = "roleId集合", required = true) @RequestParam String roleIds) {
boolean temp = userService.grant(userIds, roleIds); boolean temp = userService.grant(userIds, roleIds);
return R.status(temp); return R.status(temp);
} }
@ -158,7 +158,7 @@ public class UserController {
@PostMapping("/reset-password") @PostMapping("/reset-password")
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@Operation(summary = "初始化密码", description = "传入userId集合") @Operation(summary = "初始化密码", description = "传入userId集合")
public R resetPassword(@Parameter(name = "userId集合", required = true) @RequestParam String userIds) { public R resetPassword(@Parameter(description = "userId集合", required = true) @RequestParam String userIds) {
boolean temp = userService.resetPassword(userIds); boolean temp = userService.resetPassword(userIds);
return R.status(temp); return R.status(temp);
} }
@ -174,9 +174,9 @@ public class UserController {
@PostMapping("/update-password") @PostMapping("/update-password")
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
@Operation(summary = "修改密码", description = "传入密码") @Operation(summary = "修改密码", description = "传入密码")
public R updatePassword(BladeUser user, @Parameter(name = "旧密码", required = true) @RequestParam String oldPassword, public R updatePassword(BladeUser user, @Parameter(description = "旧密码", required = true) @RequestParam String oldPassword,
@Parameter(name = "新密码", required = true) @RequestParam String newPassword, @Parameter(description = "新密码", required = true) @RequestParam String newPassword,
@Parameter(name = "新密码", required = true) @RequestParam String newPassword1) { @Parameter(description = "新密码", required = true) @RequestParam String newPassword1) {
boolean temp = userService.updatePassword(user.getUserId(), oldPassword, newPassword, newPassword1); boolean temp = userService.updatePassword(user.getUserId(), oldPassword, newPassword, newPassword1);
return R.status(temp); return R.status(temp);
} }

View File

@ -7,12 +7,12 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<version>4.0.0</version> <version>4.1.0</version>
</parent> </parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>4.0.0</version> <version>4.1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>SpringBlade 微服务集合</description> <description>SpringBlade 微服务集合</description>

View File

@ -42,6 +42,10 @@ management:
health: health:
show-details: always show-details: always
#springdoc-openapi配置
springdoc:
default-flat-param-object: true
#knife4j配置 #knife4j配置
knife4j: knife4j:
#启用 #启用
@ -69,7 +73,7 @@ knife4j:
swagger: swagger:
title: SpringBlade 接口文档系统 title: SpringBlade 接口文档系统
description: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统
version: 4.0.0 version: 4.1.0
license: Powered By SpringBlade license: Powered By SpringBlade
licenseUrl: https://bladex.cn licenseUrl: https://bladex.cn
terms-of-service-url: https://bladex.cn terms-of-service-url: https://bladex.cn
@ -80,11 +84,16 @@ swagger:
#blade配置 #blade配置
blade: blade:
auth:
#使用 @org.springblade.test.Sm2KeyGenerator 获取,用于国密sm2验签,需和前端保持一致
public-key: 请配置sm2公钥
#使用 @org.springblade.test.Sm2KeyGenerator 获取,用于国密sm2解密,前端无需配置
private-key: 请配置sm2私钥
token: token:
#使用 blade-auth服务 @org.springblade.test.SignKeyGenerator 获取 #使用 @org.springblade.test.SignKeyGenerator 获取
sign-key: 请配置32位签名提高安全性 sign-key: 请配置32位签名
#使用 blade-auth服务 @org.springblade.test.AesKeyGenerator 获取 #使用 @org.springblade.test.SignKeyGenerator 获取
aes-key: 请配置Aes的密钥 aes-key: 请配置cryptoKey
xss: xss:
enabled: true enabled: true
skip-url: skip-url:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

16
pom.xml
View File

@ -5,12 +5,12 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<version>4.0.0</version> <version>4.1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<blade.tool.version>4.0.0</blade.tool.version> <blade.tool.version>4.1.0</blade.tool.version>
<blade.project.version>4.0.0</blade.project.version> <blade.project.version>4.1.0</blade.project.version>
<java.version>17</java.version> <java.version>17</java.version>
<maven.plugin.version>3.11.0</maven.plugin.version> <maven.plugin.version>3.11.0</maven.plugin.version>
@ -21,13 +21,13 @@
<easyexcel.version>3.3.4</easyexcel.version> <easyexcel.version>3.3.4</easyexcel.version>
<mica.auto.version>3.1.3</mica.auto.version> <mica.auto.version>3.1.3</mica.auto.version>
<spring.version>6.1.5</spring.version> <spring.version>6.1.10</spring.version>
<spring.boot.version>3.2.4</spring.boot.version> <spring.boot.version>3.2.7</spring.boot.version>
<spring.boot.admin.version>3.2.3</spring.boot.admin.version> <spring.boot.admin.version>3.2.3</spring.boot.admin.version>
<spring.cloud.version>2023.0.1</spring.cloud.version> <spring.cloud.version>2023.0.2</spring.cloud.version>
<alibaba.cloud.version>2022.0.0.0</alibaba.cloud.version> <alibaba.cloud.version>2023.0.1.0</alibaba.cloud.version>
<alibaba.nacos.version>2.3.1</alibaba.nacos.version> <alibaba.nacos.version>2.3.2</alibaba.nacos.version>
<!-- 推荐使用Harbor --> <!-- 推荐使用Harbor -->
<docker.registry.url>10.211.55.5</docker.registry.url> <docker.registry.url>10.211.55.5</docker.registry.url>

View File

@ -1,2 +1,2 @@
REGISTER=192.168.0.157/blade REGISTER=192.168.0.157/blade
TAG=4.0.0 TAG=4.1.0

View File

@ -1,13 +1,14 @@
version: '3' version: '3'
services: services:
nacos: nacos:
image: nacos/nacos-server:v2.3.1 image: nacos/nacos-server:v2.3.2
hostname: "nacos-standalone" hostname: "nacos-standalone"
environment: environment:
- NACOS_AUTH_ENABLE=true - NACOS_AUTH_ENABLE=true
- NACOS_AUTH_CACHE_ENABLE=true - NACOS_AUTH_CACHE_ENABLE=true
- NACOS_AUTH_IDENTITY_KEY=nacos - NACOS_AUTH_IDENTITY_KEY=nacos
- NACOS_AUTH_IDENTITY_VALUE=nacos - NACOS_AUTH_IDENTITY_VALUE=nacos
- NACOS_AUTH_TOKEN= # 请阅读官方文档了解规则后替换为自己的tokenhttps://nacos.io/zh-cn/docs/v2/guide/user/auth.html
- MODE=standalone - MODE=standalone
- TZ=Asia/Shanghai - TZ=Asia/Shanghai
volumes: volumes:

View File

@ -152,7 +152,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-admin - name: blade-admin
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-admin:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-admin:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -386,7 +386,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-auth - name: blade-auth
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-auth:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-auth:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -625,7 +625,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-desk - name: blade-desk
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-desk:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-desk:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -864,7 +864,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-develop - name: blade-develop
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-develop:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-develop:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1096,7 +1096,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-gateway - name: blade-gateway
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-gateway:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-gateway:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1331,7 +1331,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-log - name: blade-log
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-log:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-log:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1565,7 +1565,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-report - name: blade-report
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-report:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-report:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1799,7 +1799,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-resource - name: blade-resource
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-resource:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-resource:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -2033,7 +2033,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-system - name: blade-system
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-system:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-system:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -2267,7 +2267,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-user - name: blade-user
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-user:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-user:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -2496,7 +2496,7 @@ spec:
spec: spec:
containers: containers:
- name: saber-web - name: saber-web
image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-web:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-web:4.1.0'
ports: ports:
- name: web - name: web
containerPort: 80 containerPort: 80
@ -2721,7 +2721,7 @@ spec:
spec: spec:
containers: containers:
- name: blade-swagger - name: blade-swagger
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-swagger:4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-swagger:4.1.0'
args: args:
- '--spring.profiles.active=${PROFILE}' - '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}' - '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -3749,7 +3749,7 @@ spec:
spec: spec:
containers: containers:
- name: mysql - name: mysql
image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-db:v4.0.0' image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-db:v4.1.0'
ports: ports:
- name: mysql - name: mysql
containerPort: 3306 containerPort: 3306