初始化项目
This commit is contained in:
37
xtools-app-monitor/xtools-app-monitor-client/pom.xml
Normal file
37
xtools-app-monitor/xtools-app-monitor-client/pom.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>org.xujun</groupId>
|
||||
<artifactId>xtools-app-monitor</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<artifactId>xtools-app-monitor-client</artifactId>
|
||||
|
||||
<!-- 依赖 -->
|
||||
<dependencies>
|
||||
<!-- xtools-boot begin -->
|
||||
<!-- xtools-boot-core -->
|
||||
<dependency>
|
||||
<groupId>org.xujun</groupId>
|
||||
<artifactId>xtools-boot-core</artifactId>
|
||||
</dependency>
|
||||
<!-- xtools-boot end -->
|
||||
|
||||
<!-- SpringBoot begin -->
|
||||
<!-- SpringBootAdmin客户端 -->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringBoot-Security(权限模块) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringBoot end -->
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,33 @@
|
||||
package xtools.app.monitor.client.config;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import xtools.boot.core.interfaces.FilterWhitelist;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>Title : BootAdminFilterWhitelist</p>
|
||||
* <p>Description : BootAdminFilterWhitelist</p>
|
||||
* <p>DevelopTools : Idea_x64_v2026.1</p>
|
||||
* <p>DevelopSystem : macOS Sequoia 15.7.5</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : XuJun
|
||||
* @version : 1.0.0
|
||||
* @date : 2026/3/8 12:28
|
||||
*/
|
||||
@Component
|
||||
public class BootAdminFilterWhitelist implements FilterWhitelist {
|
||||
|
||||
/**
|
||||
* 添加过滤器白名单
|
||||
*
|
||||
* @return 过滤器白名单
|
||||
*/
|
||||
@Override
|
||||
public Set<String> add() {
|
||||
return Set.of(
|
||||
"/actuator/**"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package xtools.app.monitor.client.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
/**
|
||||
* <p>Title : SecurityConfig</p>
|
||||
* <p>Description : SecurityConfig</p>
|
||||
* <p>DevelopTools : Idea_x64_v2026.1</p>
|
||||
* <p>DevelopSystem : macOS Sequoia 15.7.5</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : XuJun
|
||||
* @version : 1.0.0
|
||||
* @date : 2026/01/17 12:30
|
||||
*/
|
||||
@Configuration
|
||||
//@AutoConfiguration(before = ManagementWebSecurityAutoConfiguration.class)
|
||||
public class BootAdminSecurityConfig {
|
||||
|
||||
/**
|
||||
* 自定义Security过滤链
|
||||
*
|
||||
* @param httpSecurity HttpSecurity
|
||||
* @return Security过滤链
|
||||
*/
|
||||
@Bean
|
||||
SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) {
|
||||
httpSecurity
|
||||
// [/actuator/**]下的所有请求需要权限,其他请求全部允许
|
||||
.authorizeHttpRequests(
|
||||
auth -> auth.requestMatchers("/actuator/**").authenticated().anyRequest().permitAll())
|
||||
// 启用httpBasic认证模式
|
||||
.httpBasic(_ -> {
|
||||
})
|
||||
// 禁用csrf
|
||||
.csrf(AbstractHttpConfigurer::disable);
|
||||
return httpSecurity.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# App信息
|
||||
info:
|
||||
app:
|
||||
# 作者
|
||||
author: '@project.organization.name@'
|
||||
# 项目名
|
||||
name: '@project.artifactId@'
|
||||
# 版本号
|
||||
version: '@project.version@'
|
||||
# 项目编码
|
||||
encoding: '@project.build.sourceEncoding@'
|
||||
# Url
|
||||
url: '@project.organization.url@'
|
||||
# Java版本
|
||||
java: '@java.version@'
|
||||
Reference in New Issue
Block a user