Compare commits
3 Commits
dev
...
hzm-gatewa
| Author | SHA1 | Date | |
|---|---|---|---|
| 01d67d2af5 | |||
|
|
9c162e611c | ||
|
|
6d39805d17 |
52
agileboot-boot-start/pom.xml
Normal file
52
agileboot-boot-start/pom.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<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>
|
||||
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
79
agileboot-boot-start/src/main/resources/application-dev.yml
Normal file
79
agileboot-boot-start/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,79 @@
|
||||
# 数据源配置
|
||||
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
|
||||
13
agileboot-boot-start/src/main/resources/application.yml
Normal file
13
agileboot-boot-start/src/main/resources/application.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
8
agileboot-boot-start/src/main/resources/banner.txt
Normal file
8
agileboot-boot-start/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Application Version: ${revision}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
_ _ _ ____ _
|
||||
/ \ __ _ (_)| | ___ | __ ) ___ ___ | |_
|
||||
/ _ \ / _` || || | / _ \| _ \ / _ \ / _ \ | __|
|
||||
/ ___ \| (_| || || || __/| |_) || (_) || (_) || |_
|
||||
/_/ \_\\__, ||_||_| \___||____/ \___/ \___/ \__|
|
||||
|___/
|
||||
18
agileboot-cloud/agileboot-cloud-start/pom.xml
Normal file
18
agileboot-cloud/agileboot-cloud-start/pom.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<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>
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.agileboot;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Author cuiJiaWang
|
||||
* @Create 2025-08-12 17:35
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class AgilebootCloudApplication {
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
15
agileboot-cloud/pom.xml
Normal file
15
agileboot-cloud/pom.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<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>
|
||||
@@ -18,7 +18,7 @@
|
||||
<module>wol-common-redis</module>
|
||||
<module>wol-common-json</module>
|
||||
<module>wol-common-satoken</module>
|
||||
<module>wol-common-nacos</module>
|
||||
<module>wol-common-naocs</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@@ -52,11 +52,7 @@
|
||||
<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>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
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}
|
||||
satoken:
|
||||
tokenName: ${SATOKEN_TOKENNAME:Authorization}
|
||||
isConcurrent: ${SATOKEN_ISCONCURRENT:true}
|
||||
isShare: ${SATOKEN_ISSHARE:true}
|
||||
isLog: ${SATOKEN_ISLOG:true}
|
||||
jwtSecretKey: ${SATOKEN_JWTSECRETKEY:abcdefghijklmnopqrstuvwxyz}
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: ${JASYPT_ENCRYPTOR_PASSWORD:}
|
||||
@@ -30,58 +30,3 @@ 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}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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}
|
||||
|
||||
@@ -1,38 +1,39 @@
|
||||
<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">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.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-nacos</artifactId>
|
||||
|
||||
<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>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- 服务发现 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
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 配置中心的服务器地址
|
||||
@@ -40,19 +40,6 @@
|
||||
<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>
|
||||
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -13,7 +12,6 @@ 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;
|
||||
@@ -21,7 +19,6 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@PropertySource(value = "classpath:common-cache.yml", factory = YmlPropertySourceFactory.class)
|
||||
public class RedisConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
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
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.agileboot.common.satoken.config;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@@ -19,9 +21,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
@ConditionalOnClass(WebMvcConfigurer.class)
|
||||
public class SaTokenMvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,7 @@ 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")
|
||||
@@ -44,13 +46,39 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
|
||||
.setAuth(obj -> {
|
||||
SaRouter.match("/**", "/auth/login", StpUtil::checkLogin);
|
||||
})
|
||||
.setError(e -> {
|
||||
if (e instanceof NotLoginException) {
|
||||
return SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
log.error("认证失败'{}',无法访问系统资源", e.getMessage());
|
||||
return SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED);
|
||||
});
|
||||
.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));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SaTokenExceptionHandler {
|
||||
public R<Void> handleNotLoginException(NotLoginException e, HttpServletRequest request) {
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage());
|
||||
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "认证失败,无法访问系统资源");
|
||||
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "2认证失败,无法访问系统资源");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,14 +13,3 @@ sa-token:
|
||||
check-same-token: false
|
||||
# token前缀
|
||||
token-prefix: "Bearer"
|
||||
|
||||
# token名称 (同时也是cookie名称)
|
||||
token-name: ${wol.satoken.tokenName}
|
||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||
is-concurrent: ${wol.satoken.isConcurrent}
|
||||
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||
is-share: ${wol.satoken.isShare}
|
||||
# 是否输出操作日志
|
||||
is-log: ${wol.satoken.isLog}
|
||||
# jwt秘钥
|
||||
jwt-secret-key: ${wol.satoken.jwtSecretKey}
|
||||
|
||||
@@ -21,9 +21,5 @@
|
||||
<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>
|
||||
|
||||
@@ -5,13 +5,25 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>wol-modules</artifactId>
|
||||
<artifactId>agileboot-system</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>agileboot-system-base</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>wol-common-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>wol-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>wol-domain</artifactId>
|
||||
</dependency>
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
@@ -10,8 +10,20 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>wol-domain</module>
|
||||
<module>wol-api</module>
|
||||
<module>wol-auth</module>
|
||||
<module>agileboot-system-base</module>
|
||||
<module>wol-gateway</module>
|
||||
<module>wol-codegenerator</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>agileboot-system-base</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -5,21 +5,13 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>agileboot</artifactId>
|
||||
<artifactId>agileboot-system</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>
|
||||
@@ -31,7 +23,6 @@
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>agileboot-system-base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -7,9 +7,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* @Author cuiJiaWang
|
||||
* @Create 2025-08-12 18:07
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"com.agileboot.auth", "com.agileboot.system"})
|
||||
@SpringBootApplication(scanBasePackages = "com.agileboot.*")
|
||||
public class WolAuthApplication {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WolAuthApplication.class, args);
|
||||
String successMsg = " ____ _ _ __ _ _ \n"
|
||||
@@ -54,7 +54,7 @@ public class AuthController {
|
||||
public R<?> login(@RequestBody String body) {
|
||||
LoginBody loginBody = JSONObject.parseObject(body, LoginBody.class);
|
||||
ValidatorUtils.validate(loginBody);
|
||||
Long clientId = Long.parseLong(loginBody.getClientId());
|
||||
Long clientId = loginBody.getClientId();
|
||||
String grantType = loginBody.getGrantType();
|
||||
SysClientVO clientVo = sysClientService.queryByClientId(clientId);
|
||||
|
||||
@@ -22,8 +22,8 @@ public class LoginBody implements Serializable {
|
||||
/**
|
||||
* 客户端id
|
||||
*/
|
||||
@NotBlank(message = "Auth clientid cannot be blank")
|
||||
private String clientId;
|
||||
@NotNull(message = "Auth clientid cannot be blank")
|
||||
private Long clientId;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user