20 Commits

Author SHA1 Message Date
cuijiawang
406f20f7cb fix(gateway): 注释掉客户端ID与Token匹配检查逻辑- 临时注释掉Sa-Token中的客户端ID与Token匹配检查代码
- 保留原有登录校验逻辑
- 为后续重新设计客户端认证机制做准备
2025-10-23 17:30:00 +08:00
cuijiawang
fb130a65f3 feat(nacos): 添加配置导入功能- 在nacos.yml中新增config.import配置项
- 支持从Nacos服务器可选导入应用配置文件
- 配置文件路径使用应用名和文件扩展名变量
- 实现配置的动态加载和热更新支持
2025-10-23 16:49:20 +08:00
cuijiawang
8847f3edef chore(deps): 添加spring依赖-boot-starter-test
- 在wol-common-web模块中添加测试依赖
- 引入spring-boot-starter-test以支持单元测试
- 为后续测试代码提供基础框架支持
2025-10-23 11:18:10 +08:00
cuijiawang
18bb9f9c95 fix 2025-10-23 10:54:36 +08:00
cuijiawang
979f2aa5f0 fix 2025-10-23 10:47:44 +08:00
cuijiawang
189930f0ab fix 2025-10-23 10:03:34 +08:00
cuijiawang
3c78e2bb53 fix 2025-10-23 09:51:56 +08:00
cuijiawang
63dc394c54 feat(gateway): 添加开发环境网关路由配置
- 配置了服务发现定位器启用- 添加了指向wol-auth服务的路由
- 设置了路径匹配规则为/auth/**
2025-10-23 09:44:04 +08:00
cuijiawang
f24137eb8f fix 2025-10-22 16:49:46 +08:00
cuijiawang
504fc94b8c fix 2025-10-22 12:08:53 +08:00
cuijiawang
6ef6a344c6 fix 2025-10-22 11:31:00 +08:00
cuijiawang
5e3e0890f3 fix 2025-10-21 18:01:02 +08:00
cuijiawang
b7a7fca5f3 fix 2025-10-21 17:54:02 +08:00
cuijiawang
6adfe238be fix 2025-10-21 17:51:37 +08:00
cuijiawang
c1eac2a224 fix 2025-10-14 17:28:29 +08:00
cuijiawang
c5b01251d8 fix 2025-10-13 17:06:23 +08:00
cuijiawang
d40232d335 fix 2025-10-13 17:02:08 +08:00
cuijiawang
f37ea57bce fix 2025-10-13 17:01:12 +08:00
cuijiawang
b366869a00 gateway 2025-10-13 16:32:54 +08:00
cuijiawang
a8e2887bbf fix 2025-10-11 09:55:31 +08:00
275 changed files with 473 additions and 559 deletions

View File

@@ -1,52 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>agileboot-boot-start</artifactId>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system-base</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-module-ai</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-auth</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-codegenerator</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,24 +0,0 @@
package com.agileboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Author cuiJiaWang
* @Create 2025-08-12 18:07
*/
@SpringBootApplication(scanBasePackages = "com.agileboot.*")
public class AgilebootBootApplication {
public static void main(String[] args) {
SpringApplication.run(AgilebootBootApplication.class, args);
String successMsg = " ____ _ _ __ _ _ \n"
+ " / ___| | |_ __ _ _ __ | |_ _ _ _ __ ___ _ _ ___ ___ ___ ___ ___ / _| _ _ | || |\n"
+ " \\___ \\ | __|/ _` || '__|| __| | | | || '_ \\ / __|| | | | / __|/ __|/ _ \\/ __|/ __|| |_ | | | || || |\n"
+ " ___) || |_| (_| || | | |_ | |_| || |_) | \\__ \\| |_| || (__| (__| __/\\__ \\\\__ \\| _|| |_| || ||_|\n"
+ " |____/ \\__|\\__,_||_| \\__| \\__,_|| .__/ |___/ \\__,_| \\___|\\___|\\___||___/|___/|_| \\__,_||_|(_)\n"
+ " |_| ";
System.out.println(successMsg);
}
}

View File

@@ -1,79 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
username: agileboot
password: 123456
data:
redis:
database: 3
host: 121.41.64.98
port: 6379
password: 'Wyy123123'
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}
# Sa-Token配置
sa-token:
# token名称 (同时也是cookie名称)
token-name: Authorization
# 开启内网服务调用鉴权(不允许越过gateway访问内网服务 保障服务安全)
check-same-token: false
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# 是否输出操作日志
is-log: true
# jwt秘钥
jwt-secret-key: abcdefghijklmnopqrstuvwxyz

View File

@@ -1,13 +0,0 @@
server:
port: 18080
servlet:
context-path: /
tomcat:
uri-encoding: UTF-8 # tomcat的URI编码
accept-count: 1000 # 连接数满后的排队数默认为100
threads:
max: 800 # tomcat最大线程数默认为200
min-spare: 100 # Tomcat启动初始化的线程数默认值10
spring:
profiles:
active: dev

View File

@@ -1,8 +0,0 @@
Application Version: ${revision}
Spring Boot Version: ${spring-boot.version}
_ _ _ ____ _
/ \ __ _ (_)| | ___ | __ ) ___ ___ | |_
/ _ \ / _` || || | / _ \| _ \ / _ \ / _ \ | __|
/ ___ \| (_| || || || __/| |_) || (_) || (_) || |_
/_/ \_\\__, ||_||_| \___||____/ \___/ \___/ \__|
|___/

View File

@@ -1,18 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-cloud</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>agileboot-cloud-start</artifactId>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-web</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,11 +0,0 @@
package com.agileboot;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Author cuiJiaWang
* @Create 2025-08-12 17:35
*/
@SpringBootApplication
public class AgilebootCloudApplication {
}

View File

@@ -1,15 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>agileboot-cloud</artifactId>
<packaging>pom</packaging>
<modules>
<module>agileboot-cloud-start</module>
</modules>
</project>

View File

@@ -18,7 +18,7 @@
<module>wol-common-redis</module>
<module>wol-common-json</module>
<module>wol-common-satoken</module>
<module>wol-common-naocs</module>
<module>wol-common-nacos</module>
</modules>
<packaging>pom</packaging>

View File

@@ -52,7 +52,11 @@
<artifactId>wol-common-satoken</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@@ -0,0 +1,21 @@
wol:
mysql:
maser:
url: ${MYSQL_URL:121.41.64.98:3306}
username: ${MYSQL_USERNAME:agileboot}
password: ${MYSQL_PASSWORD:123456}
redis:
database: ${REDIS_DATABASE:3}
host: ${REDIS_HOST:121.41.64.98}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:'Wyy123123'}
nacos:
server:
addr: ${NACOS_ADDR:192.168.110.27:8848}
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
namespace: ${NACOS_NAMESPACE:public}
group: ${NACOS_GROUP:DEFAULT_GROUP}
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}

View File

@@ -30,3 +30,58 @@ mybatis-plus:
insertStrategy: NOT_NULL
updateStrategy: NOT_NULL
whereStrategy: NOT_NULL
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://${wol.mysql.maser.url}/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${wol.mysql.maser.username}
password: ${wol.mysql.maser.password}

View File

@@ -1,39 +1,38 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-common</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>wol-common-naocs</artifactId>
<name>wol-common-naocs</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>wol-common-nacos</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<!-- 服务发现 -->
<!-- Nacos 服务注册与发现-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 配置中心 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- Spring Boot 3 + Spring Cloud 2023 默认不启用 bootstrap -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,22 @@
spring:
cloud:
nacos:
discovery:
server-addr: ${wol.nacos.server.addr}
username: ${wol.nacos.server.username}
password: ${wol.nacos.server.password}
group: ${wol.nacos.server.group}
namespace: ${wol.nacos.server.namespace}
config:
server-addr: ${wol.nacos.server.addr}
group: ${wol.nacos.server.group}
namespace: ${wol.nacos.server.namespace}
file-extension: yaml
refresh-enabled: true # 是否开启动态刷新
name: ${spring.application.name}
username: ${wol.nacos.server.username}
password: ${wol.nacos.server.password}
config:
import:
- optional:nacos:${spring.application.name}.${spring.cloud.nacos.config.file-extension}

View File

@@ -1,14 +0,0 @@
spring:
cloud:
nacos:
config:
server-addr: http://192.168.12.168:8848 # 指定 Nacos 配置中心的服务器地址
group: DEFAULT_GROUP # 所属组
namespace: public # 命名空间
file-extension: yaml # 配置文件格式
refresh-enabled: true # 是否开启动态刷新
discovery:
enabled: true # 启用服务发现
group: DEFAULT_GROUP # 所属组
namespace: public # 命名空间
server-addr: http://192.168.12.168:8848 # 指定 Nacos 配置中心的服务器地址

View File

@@ -40,6 +40,19 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- JetCache -->
<!-- <dependency>-->
<!-- <groupId>com.alicp.jetcache</groupId>-->
<!-- <artifactId>jetcache-starter-redisson</artifactId>-->
<!-- <version>2.7.5</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-logging</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
</dependencies>
</project>
</project>

View File

@@ -1,5 +1,6 @@
package com.agileboot.common.redis.config;
import com.agileboot.common.core.factory.YmlPropertySourceFactory;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.PropertyAccessor;
@@ -12,6 +13,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
@@ -19,6 +21,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@Slf4j
@AutoConfiguration
@PropertySource(value = "classpath:common-cache.yml", factory = YmlPropertySourceFactory.class)
public class RedisConfiguration {
@Bean

View File

@@ -0,0 +1,46 @@
spring:
data:
redis:
database: ${wol.redis.database}
host: ${wol.redis.host}
port: ${wol.redis.port}
password: ${wol.redis.password}
redis:
redisson:
config: |
singleServerConfig:
idleConnectionTimeout: 10000
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
password: ${wol.redis.password}
subscriptionsPerConnection: 5
clientName: null
address: "redis://${wol.redis.host}:${wol.redis.port}"
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 24
connectionPoolSize: 64
database: ${wol.redis.database}
dnsMonitoringInterval: 5000
threads: 16
nettyThreads: 32
codec: !<org.redisson.client.codec.StringCodec> {}
transportMode: "NIO"
jetcache:
statIntervalMinutes: 1
areaInCacheName: false
local:
default:
type: caffeine
keyConvertor: fastjson2
remote:
default:
type: redisson
keyConvertor: fastjson2
broadcastChannel: ${spring.application.name}
keyPrefix: ${spring.application.name}
valueEncoder: java
valueDecoder: java
defaultExpireInMillis: 5000

View File

@@ -1,17 +1,13 @@
package com.agileboot.common.satoken.config;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.filter.SaServletFilter;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.same.SaSameUtil;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.agileboot.common.core.constant.HttpStatus;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -22,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @author Lion Li
*/
@AutoConfiguration
@ConditionalOnClass(WebMvcConfigurer.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class SaTokenMvcConfiguration implements WebMvcConfigurer {
/**
@@ -38,7 +34,6 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
* 注册 [Sa-Token全局过滤器]
*/
@Bean
@ConditionalOnMissingClass("cn.dev33.satoken.reactor.spring.SaTokenContextRegister")
public SaServletFilter getGlobleSaServletFilter() {
return new SaServletFilter()
.addInclude("/**").addExclude("/favicon.ico")
@@ -49,36 +44,4 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
.setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED));
}
/**
* 校验是否从网关转发
*/
@Bean
@ConditionalOnMissingBean(SaServletFilter.class)
public SaServletFilter getSaServletFilter() {
return new SaServletFilter()
.addInclude("/**")
.addExclude("/actuator", "/actuator/**")
.setAuth(obj -> {
if (SaManager.getConfig().getCheckSameToken()) {
SaSameUtil.checkCurrentRequestToken();
}
})
.setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED));
}
/**
* 对 actuator 健康检查接口 做账号密码鉴权
*/
// @Bean
// public SaServletFilter actuatorFilter() {
// String username = SpringUtil.getProperty("spring.cloud.nacos.discovery.metadata.username");
// String password = SpringUtil.getProperty("spring.cloud.nacos.discovery.metadata.userpassword");
// return new SaServletFilter()
// .addInclude("/actuator", "/actuator/**")
// .setAuth(obj -> {
// SaHttpBasicUtil.check(username + ":" + password);
// })
// .setError(e -> SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED));
// }
}

View File

@@ -21,5 +21,9 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -10,20 +10,8 @@
<packaging>pom</packaging>
<modules>
<module>wol-auth</module>
<module>agileboot-system-base</module>
<module>wol-gateway</module>
<module>wol-codegenerator</module>
<module>wol-domain</module>
<module>wol-api</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system-base</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<artifactId>agileboot-system</artifactId>
<version>1.0.0</version>
</parent>
@@ -19,4 +19,4 @@
</dependency>
</dependencies>
</project>
</project>

View File

@@ -1,108 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
username: agileboot
password: 123456
data:
redis:
database: 3
host: 121.41.64.98
port: 6379
password: 'Wyy123123'
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}
# redisson 配置
#redisson:
# # redis key前缀
# keyPrefix:
# # 线程池数量
# threads: 4
# # Netty线程池数量
# nettyThreads: 8
# # 单节点配置
# singleServerConfig:
# # 客户端名称
# clientName: ${spring.application.name}
# # 最小空闲连接数
# connectionMinimumIdleSize: 8
# # 连接池大小
# connectionPoolSize: 32
# # 连接空闲超时,单位:毫秒
# idleConnectionTimeout: 10000
# # 命令等待超时,单位:毫秒
# timeout: 3000
# # 发布和订阅连接池大小
# subscriptionConnectionPoolSize: 50
# 分布式锁 lock4j 全局配置
#lock4j:
# # 获取分布式锁超时时间,默认为 3000 毫秒
# acquire-timeout: 3000
# # 分布式锁的超时时间,默认为 30 秒
# expire: 30000
# Sa-Token配置
sa-token:
# token名称 (同时也是cookie名称)
token-name: Authorization
# 开启内网服务调用鉴权(不允许越过gateway访问内网服务 保障服务安全)
check-same-token: false
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# 是否输出操作日志
is-log: true
# jwt秘钥
jwt-secret-key: abcdefghijklmnopqrstuvwxyz

View File

@@ -1,9 +0,0 @@
server:
port: 9210
servlet:
context-path: /
spring:
application:
name: agileboot-system
profiles:
active: dev

View File

@@ -1,7 +0,0 @@
server:
port: 9211
spring:
application:
name: wol-codegen
profiles:
active: dev

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<artifactId>agileboot-system</artifactId>
<version>1.0.0</version>
</parent>
@@ -34,4 +34,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>

View File

@@ -1,61 +0,0 @@
package com.agileboot.gateway.filter;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.reactor.context.SaReactorSyncHolder;
import cn.dev33.satoken.reactor.filter.SaReactorFilter;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.agileboot.common.core.constant.HttpStatus;
import com.agileboot.common.satoken.utils.LoginHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.server.reactive.ServerHttpRequest;
/**
* [Sa-Token 权限认证] 拦截器
*
* @author Lion Li
*/
@Configuration
public class AuthFilter {
/**
* 注册 Sa-Token 全局过滤器
*/
@Bean
public SaReactorFilter getSaReactorFilter() {
return new SaReactorFilter()
// 拦截地址
.addInclude("/**")
.addExclude("/favicon.ico", "/actuator", "/actuator/**", "/resource/sse")
// 鉴权方法:每次访问进入
.setAuth(obj -> {
// 登录校验 -- 拦截所有路由
SaRouter.match("/**")
.check(r -> {
ServerHttpRequest request = SaReactorSyncHolder.getExchange().getRequest();
// 检查是否登录 是否有token
StpUtil.checkLogin();
// 检查 header 与 param 里的 clientid 与 token 里的是否一致
String headerCid = request.getHeaders().getFirst(LoginHelper.CLIENT_KEY);
String paramCid = request.getQueryParams().getFirst(LoginHelper.CLIENT_KEY);
String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString();
if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) {
// token 无效
throw NotLoginException.newInstance(StpUtil.getLoginType(),
"-100", "客户端ID与Token不匹配",
StpUtil.getTokenValue());
}
});
}).setError(e -> {
if (e instanceof NotLoginException) {
return SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED);
}
return SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED);
});
}
}

View File

@@ -1,6 +0,0 @@
server:
port: 8080
spring:
application:
name: wol-gateway

View File

@@ -1,3 +0,0 @@
spring:
config:
import: classpath:nacos.yml

44
pom.xml
View File

@@ -17,12 +17,9 @@
<modules>
<module>agileboot-common</module>
<module>agileboot-system</module>
<module>agileboot-boot-start</module>
<module>agileboot-cloud</module>
<module>wol-domain</module>
<module>wol-api</module>
<module>wol-auth</module>
<module>wol-gateway</module>
<module>wol-modules</module>
<module>agileboot-common/wol-common-naocs</module>
</modules>
<packaging>pom</packaging>
@@ -31,10 +28,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<spring.boot.version>3.4.5</spring.boot.version>
<spring.boot.version>3.4.7</spring.boot.version>
<spring-cloud.version>2024.0.0</spring-cloud.version>
<!--SpringCloudAlibaba-->
<spring-cloud-alibaba.version>2023.0.0.0-RC1</spring-cloud-alibaba.version>
<spring-cloud-alibaba.version>2023.0.3.3</spring-cloud-alibaba.version>
<mybatis.version>3.5.16</mybatis.version>
<mybatis-plus.version>3.5.12</mybatis-plus.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version>
@@ -53,6 +49,7 @@
<satoken.version>1.44.0</satoken.version>
<oshi.version>6.4.0</oshi.version>
<!-- 插件版本 -->
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
@@ -74,7 +71,7 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Cloud Alibaba依赖管理 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
@@ -303,17 +300,6 @@
<artifactId>fastjson2</artifactId>
<version>${fastjson2.version}</version>
</dependency>
<!-- Nacos 配置中心 -->
<!-- <dependency>-->
<!-- <groupId>com.alibaba.boot</groupId>-->
<!-- <artifactId>nacos-config-spring-boot-starter</artifactId>-->
<!-- <version>${nacos-config.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-naocs</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -340,6 +326,24 @@
<build>
<!-- 用 @application.name@ 让 Maven 替换变量,确保 pom.xml 开启 资源过滤 -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.xdb</exclude> <!-- 不过滤二进制文件 -->
<exclude>**/*.png</exclude>
<exclude>**/*.jpg</exclude>
<exclude>**/*.ico</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/static</directory>
<filtering>false</filtering> <!-- 静态文件完全不过滤 -->
</resource>
</resources>
<pluginManagement>
<plugins>

View File

@@ -5,13 +5,21 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system</artifactId>
<artifactId>agileboot</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>wol-auth</artifactId>
<properties>
<application.name>wol-auth</application.name>
</properties>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-satoken</artifactId>
@@ -23,6 +31,7 @@
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system-base</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

Some files were not shown because too many files have changed in this diff Show More