mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-06 10:35:32 +08:00
后台目录结构大调整,让结构更清晰
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package org.jeecg.monitor;
|
||||
|
||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 监控服务
|
||||
* @author zyf
|
||||
* @date: 2022/4/21 10:55
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableAdminServer
|
||||
public class JeecgMonitorApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JeecgMonitorApplication.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package org.jeecg.monitor.config;
|
||||
|
||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
|
||||
|
||||
/**
|
||||
* @author scott
|
||||
*/
|
||||
@Configuration
|
||||
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private final String adminContextPath;
|
||||
|
||||
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
|
||||
this.adminContextPath = adminServerProperties.getContextPath();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
// 登录成功处理类
|
||||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
||||
successHandler.setTargetUrlParameter("redirectTo");
|
||||
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
||||
|
||||
http.authorizeRequests()
|
||||
//静态文件允许访问
|
||||
.antMatchers(adminContextPath + "/assets/**").permitAll()
|
||||
//登录页面允许访问
|
||||
.antMatchers(adminContextPath + "/login", "/css/**", "/js/**", "/image/*").permitAll()
|
||||
//其他所有请求需要登录
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
//登录页面配置,用于替换security默认页面
|
||||
.formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
|
||||
//登出页面配置,用于替换security默认页面
|
||||
.logout().logoutUrl(adminContextPath + "/logout").and()
|
||||
.httpBasic().and()
|
||||
.csrf()
|
||||
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
|
||||
.ignoringAntMatchers(
|
||||
"/instances",
|
||||
"/actuator/**"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
server:
|
||||
port: 9111
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
ui:
|
||||
title: JeecgCloud监控中心
|
||||
client:
|
||||
instance:
|
||||
metadata:
|
||||
tags:
|
||||
environment: local
|
||||
security:
|
||||
user:
|
||||
name: "admin"
|
||||
password: "admin"
|
||||
application:
|
||||
name: jeecg-monitor
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @config.server-addr@
|
||||
metadata:
|
||||
user.name: ${spring.security.user.name}
|
||||
user.password: ${spring.security.user.password}
|
||||
# 服务端点检查
|
||||
management:
|
||||
trace:
|
||||
http:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
Reference in New Issue
Block a user