Skip to content

Commit

Permalink
refactor: 适配 ContiNew Starter 认证模块-SaToken
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Nov 25, 2023
1 parent 8a11a02 commit 86ca8f0
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 188 deletions.
19 changes: 6 additions & 13 deletions continew-admin-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
<description>公共模块(存放公共工具类,公共配置等)</description>

<dependencies>
<!-- ContiNew Starter 认证模块 - SaToken -->
<dependency>
<groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter-auth-satoken</artifactId>
</dependency>

<!-- ContiNew Starter 数据访问模块 - MyBatis Plus -->
<dependency>
<groupId>top.charles7c.continew</groupId>
Expand Down Expand Up @@ -65,19 +71,6 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<!-- ################ Sa-Token 相关 ################ -->
<!-- Sa-Token(轻量级 Java 权限认证框架,让鉴权变得简单、优雅) -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
</dependency>

<!-- Sa-Token 整合 JWT -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-jwt</artifactId>
</dependency>

<!-- MySQL Java 驱动 -->
<dependency>
<groupId>com.mysql</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class CaptchaProperties {

/**
* 过期时间
* 图形验证码过期时间
*/
@Value("${captcha.graphic.expirationInMinutes}")
private long expirationInMinutes;
Expand Down

This file was deleted.

This file was deleted.

42 changes: 22 additions & 20 deletions continew-admin-webapi/src/main/resources/config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,6 @@ captcha:
# 模板 ID
templateId: 1

--- ### 安全配置-排除路径配置
security.excludes:
- /error
# 静态资源
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /webSocket/**
# 接口文档相关资源
- /favicon.ico
- /doc.html
- /webjars/**
- /swagger-ui/**
- /swagger-resources/**
- /*/api-docs/**
# 本地存储资源
- /avatar/**
- /file/**

--- ### 非对称加密配置(例如:密码加密传输,前端公钥加密,后端私钥解密;在线生成 RSA 密钥对:http:https://web.chacuo.net/netrsakeypair)
rsa:
# 私钥
Expand All @@ -197,6 +177,28 @@ springdoc:
swagger-ui:
enabled: true

--- ### Sa-Token 扩展配置
sa-token.extension:
# 安全配置:排除(放行)路径配置
security.excludes:
- /error
# 静态资源
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /webSocket/**
# 接口文档相关资源
- /favicon.ico
- /doc.html
- /webjars/**
- /swagger-ui/**
- /swagger-resources/**
- /*/api-docs/**
# 本地存储资源
- /avatar/**
- /file/**

--- ### 文件上传配置
spring.servlet:
multipart:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,6 @@ captcha:
# 模板 ID
templateId: 1

--- ### 安全配置-排除路径配置
security.excludes:
- /error
# 静态资源
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /webSocket/**
# 本地存储资源
- /avatar/**
- /file/**

--- ### 非对称加密配置(例如:密码加密传输,前端公钥加密,后端私钥解密;在线生成 RSA 密钥对:http:https://web.chacuo.net/netrsakeypair)
rsa:
# 私钥
Expand All @@ -196,6 +183,21 @@ knife4j:
# 开启生产环境屏蔽
production: true

--- ### Sa-Token 扩展配置
sa-token.extension:
# 安全配置:排除(放行)路径配置
security.excludes:
- /error
# 静态资源
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /webSocket/**
# 本地存储资源
- /avatar/**
- /file/**

--- ### 文件上传配置
spring.servlet:
multipart:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ sa-token:
is-log: false
# JWT 秘钥
jwt-secret-key: asdasdasifhueuiwyurfewbfjsdafjk
## 扩展配置
extension:
enabled: true
# 自定义缓存实现
dao-impl: top.charles7c.cnadmin.auth.config.satoken.SaTokenRedisDaoImpl
# 权限认证实现
permission-impl: top.charles7c.cnadmin.auth.config.satoken.SaTokenPermissionImpl

--- ### MyBatis Plus 配置
mybatis-plus:
Expand Down
27 changes: 4 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
xsi:schemaLocation="http:https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--
下方 parent 为 ContiNew Starter(Continue New Starter),是一种特殊类型的 Spring Boot Starter,其作用与常规的 Starter 类似,它可以帮助开发人员快速集成常用的第三方库或工具到 Spring 应用程序中。ContiNew Starter 包含了一系列经过优化和配置的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,从而避免开发人员手动引入依赖的麻烦,为 Spring Boot 项目的灵活快速构建提供支持。
下方 parent 为 ContiNew Starter(Continue New Starter),
是一种特殊类型的 Spring Boot Starter,其作用与常规的 Starter 类似,它可以帮助开发人员快速集成常用的第三方库或工具到 Spring 应用程序中。
ContiNew Starter 包含了一系列经过优化和配置的依赖包(如 MyBatis-Plus、SaToken),
可轻松集成到应用中,从而避免开发人员手动引入依赖的麻烦,为 Spring Boot 项目的灵活快速构建提供支持。
-->
<parent>
<groupId>top.charles7c.continew</groupId>
Expand All @@ -31,7 +34,6 @@

<properties>
<revision>2.1.0-SNAPSHOT</revision>
<sa-token.version>1.37.0</sa-token.version>

<!-- ### 工具库相关 ### -->
<sms4j.version>3.0.4</sms4j.version>
Expand All @@ -46,27 +48,6 @@
<!-- 全局依赖版本管理 -->
<dependencyManagement>
<dependencies>
<!-- ################ Sa-Token 相关 ################ -->
<!-- Sa-Token(轻量级 Java 权限认证框架,让鉴权变得简单、优雅) -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
<version>${sa-token.version}</version>
</dependency>

<!-- Sa-Token 整合 JWT -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-jwt</artifactId>
<version>${sa-token.version}</version>
<exclusions>
<exclusion>
<groupId>cn.hutool</groupId>
<artifactId>hutool-jwt</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- ################ 工具库相关 ################ -->
<!-- SMS4J(短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程) -->
<dependency>
Expand Down

0 comments on commit 86ca8f0

Please sign in to comment.