diff --git a/continew-admin-common/pom.xml b/continew-admin-common/pom.xml
index dcaea4ce7..0247aaa72 100644
--- a/continew-admin-common/pom.xml
+++ b/continew-admin-common/pom.xml
@@ -17,6 +17,12 @@
公共模块(存放公共工具类,公共配置等)
+
+
+ top.charles7c.continew
+ continew-starter-auth-satoken
+
+
top.charles7c.continew
@@ -65,19 +71,6 @@
spring-boot-starter-validation
-
-
-
- cn.dev33
- sa-token-spring-boot3-starter
-
-
-
-
- cn.dev33
- sa-token-jwt
-
-
com.mysql
diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/config/properties/CaptchaProperties.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/config/properties/CaptchaProperties.java
index 9983799fd..34a1834f5 100644
--- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/config/properties/CaptchaProperties.java
+++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/config/properties/CaptchaProperties.java
@@ -38,7 +38,7 @@
public class CaptchaProperties {
/**
- * 过期时间
+ * 图形验证码过期时间
*/
@Value("${captcha.graphic.expirationInMinutes}")
private long expirationInMinutes;
diff --git a/continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/config/satoken/SaTokenConfiguration.java b/continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/config/satoken/SaTokenConfiguration.java
deleted file mode 100644
index f58195796..000000000
--- a/continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/config/satoken/SaTokenConfiguration.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package top.charles7c.cnadmin.auth.config.satoken;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import cn.dev33.satoken.dao.SaTokenDao;
-import cn.dev33.satoken.interceptor.SaInterceptor;
-import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
-import cn.dev33.satoken.stp.StpInterface;
-import cn.dev33.satoken.stp.StpLogic;
-import cn.dev33.satoken.stp.StpUtil;
-
-/**
- * Sa-Token 配置
- *
- * @author Lion Li(RuoYi-Vue-Plus)
- * @author Charles7c
- * @since 2022/12/19 22:13
- */
-@Slf4j
-@Configuration
-@RequiredArgsConstructor
-public class SaTokenConfiguration implements WebMvcConfigurer {
-
- private final SecurityProperties securityProperties;
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- // 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验
- registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())).addPathPatterns("/**")
- .excludePathPatterns(securityProperties.getExcludes());
- }
-
- /**
- * Sa-Token 整合 JWT(简单模式)
- */
- @Bean
- public StpLogic stpLogic() {
- return new StpLogicJwtForSimple();
- }
-
- /**
- * Sa-Token 持久层本地 Redis 适配
- */
- @Bean
- public SaTokenDao saTokenDao() {
- return new SaTokenRedisDaoImpl();
- }
-
- /**
- * Sa-Token 权限认证适配
- */
- @Bean
- public StpInterface stpInterface() {
- return new SaTokenPermissionImpl();
- }
-}
diff --git a/continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/config/satoken/SecurityProperties.java b/continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/config/satoken/SecurityProperties.java
deleted file mode 100644
index 9446445bb..000000000
--- a/continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/config/satoken/SecurityProperties.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package top.charles7c.cnadmin.auth.config.satoken;
-
-import lombok.Data;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * Sa-Token 安全配置属性
- *
- * @author Lion Li(RuoYi-Vue-Plus)
- * @author Charles7c
- * @since 2022/12/19 22:14
- */
-@Data
-@Component
-@ConfigurationProperties(prefix = "security")
-public class SecurityProperties {
-
- /**
- * 排除路径配置
- */
- private String[] excludes = new String[0];
-}
diff --git a/continew-admin-webapi/src/main/resources/config/application-dev.yml b/continew-admin-webapi/src/main/resources/config/application-dev.yml
index 64b31f6a9..ea67ce4c8 100644
--- a/continew-admin-webapi/src/main/resources/config/application-dev.yml
+++ b/continew-admin-webapi/src/main/resources/config/application-dev.yml
@@ -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://web.chacuo.net/netrsakeypair)
rsa:
# 私钥
@@ -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:
diff --git a/continew-admin-webapi/src/main/resources/config/application-prod.yml b/continew-admin-webapi/src/main/resources/config/application-prod.yml
index f4f4fd6a0..9b90f60ea 100644
--- a/continew-admin-webapi/src/main/resources/config/application-prod.yml
+++ b/continew-admin-webapi/src/main/resources/config/application-prod.yml
@@ -162,19 +162,6 @@ captcha:
# 模板 ID
templateId: 1
---- ### 安全配置-排除路径配置
-security.excludes:
- - /error
- # 静态资源
- - /*.html
- - /**/*.html
- - /**/*.css
- - /**/*.js
- - /webSocket/**
- # 本地存储资源
- - /avatar/**
- - /file/**
-
--- ### 非对称加密配置(例如:密码加密传输,前端公钥加密,后端私钥解密;在线生成 RSA 密钥对:http://web.chacuo.net/netrsakeypair)
rsa:
# 私钥
@@ -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:
diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml
index 738b4422d..027a6a29c 100644
--- a/continew-admin-webapi/src/main/resources/config/application.yml
+++ b/continew-admin-webapi/src/main/resources/config/application.yml
@@ -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:
diff --git a/pom.xml b/pom.xml
index 2748a5c91..5ea0438c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
top.charles7c.continew
@@ -31,7 +34,6 @@
2.1.0-SNAPSHOT
- 1.37.0
3.0.4
@@ -46,27 +48,6 @@
-
-
-
- cn.dev33
- sa-token-spring-boot3-starter
- ${sa-token.version}
-
-
-
-
- cn.dev33
- sa-token-jwt
- ${sa-token.version}
-
-
- cn.hutool
- hutool-jwt
-
-
-
-