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

This commit is contained in:
smallchill 2024-07-14 23:25:32 +08:00
parent 48210a4a60
commit 8947b4b9fd
6 changed files with 48 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<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/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-2023-blue.svg" alt="Coverage Status">
@ -32,12 +32,13 @@
| 技术栈 | 版本 |
|----------------------|------------|
| Java | 17+ |
| Spring | 6.1.5 |
| Spring Boot | 3.2.4 |
| Spring Cloud | 2023.0.1 |
| Spring Cloud Alibaba | 2022.0.0.0 |
| Nacos Alibaba | 2.3.1 |
| Mybatis Plus | 3.5.6 |
| 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 |
## 工程结构

View File

@ -1,11 +1,11 @@
{
"name": "sword-admin",
"version": "4.0.0",
"version": "4.1.0",
"description": "An out-of-box UI solution for enterprise applications",
"private": true,
"scripts": {
"presite": "cd functions && npm install",
"start": "cross-env MOCK=none PORT=1888 umi dev",
"start": "export NODE_OPTIONS=--openssl-legacy-provider && cross-env MOCK=none PORT=1888 umi dev",
"start:no-mock": "cross-env MOCK=none PORT=1888 umi dev",
"start:mock": "cross-env APP_TYPE=site PORT=1888 umi dev",
"build": "umi build",
@ -39,6 +39,7 @@
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"classnames": "^2.2.6",
"crypto-js": "^4.0.0",
"sm-crypto": "^0.3.13",
"dva": "^2.4.1",
"enquire-js": "^0.2.1",
"hash.js": "^1.1.7",

View File

@ -16,6 +16,10 @@ module.exports = {
disableLocal: false,
},
pwa: true,
auth: {
// 使用后端工程 @org.springblade.test.Sm2KeyGenerator 获取
publicKey: '04e6862d0819ec55e9d7d8bb961ccc8c2b7d86b6845ac333d1d9ab8af6a892cebb3d30f952da4111971908eb02829459170bdd338e7a27fa57d6300dc290d052b5',
},
// 第三方登陆授权地址
authUrl: 'http://localhost/blade-auth/oauth/render',
// 报表设计器地址(cloud端口为8108,boot端口为80)

View File

@ -20,7 +20,7 @@ class Workplace extends PureComponent {
<Row gutter={24}>
<Col span={24}>
<div style={{ textAlign: '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/Spring%20Cloud-2023-blue.svg"
@ -212,7 +212,20 @@ class Workplace extends PureComponent {
</Row>
<Row gutter={24}>
<Card className={styles.card} bordered={false}>
<Collapse bordered={false} defaultActiveKey={['36']}>
<Collapse bordered={false} defaultActiveKey={['37']}>
<Panel header="4.1.0发布 登录认证升级国密算法数据库password字段无需变动" key="37">
<div>1.[升级]SpringBoot 3.2.7</div>
<div>2.[升级]SpringCloud 2023.0.2</div>
<div>3.[升级]AlibabaCloud 2023.0.1.0</div>
<div>4.[升级]Nacos 2.3.2</div>
<div>5.[升级]MybatisPlus 3.5.7</div>
<div>6.[新增]登录认证升级为国密sm2算法数据库字段无需变动</div>
<div>7.[新增]oss内网上传后转换返回外网地址</div>
<div>8.[新增]saber2与saber3支持nodejs18编译</div>
<div>9.[优化]完善swagger与springdoc的配置</div>
<div>10.[优化]重构StringUtil的format方法</div>
<div>11.[优化]saveOrUpdate方法增加业务字段更新逻辑</div>
</Panel>
<Panel header="4.0.0发布 升级 SpringBoot3 SpringCloud2023 JDK17" key="36">
<div>1.[升级]JDK Java17</div>
<div>2.[升级]SpringBoot 3.2.4</div>

View File

@ -3,11 +3,13 @@ import request from '../utils/request';
import func from '../utils/Func';
import { getCaptchaKey } from '../utils/authority';
import { captchaMode } from '../defaultSettings';
import encrypt from '../utils/sm2'
// =====================用户===========================
export async function accountLogin(params) {
const values = params;
values.password = encrypt(params.password);
values.grantType = captchaMode ? 'captcha' : 'password';
values.scope = 'all';
return request('/api/blade-auth/token', {

16
src/utils/sm2.js Normal file
View File

@ -0,0 +1,16 @@
import { sm2 } from 'sm-crypto';
import { auth } from '../defaultSettings';
/**
* sm2 加密方法
* @param data
* @returns {*}
*/
export default function encrypt(data) {
try {
return sm2.doEncrypt(data, auth.publicKey, 0);
} catch {
return '';
}
}