mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-06-23 21:48:30 +00:00
上传通用模块/代码生成模块/网关基础服务/监控基础服务/用户微服务
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
package com.java2nb.novel.monitor;
|
||||
|
||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 监控服务启动器
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@EnableAdminServer
|
||||
@SpringBootApplication
|
||||
public class NovelMonitorApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NovelMonitorApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.java2nb.novel.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.csrf.CookieCsrfTokenRepository;
|
||||
|
||||
/**
|
||||
* 监控安全配置
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@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 {
|
||||
|
||||
http.authorizeRequests()
|
||||
//配置以公开访问的静态资源和登录页
|
||||
.antMatchers(adminContextPath + "/assets/**").permitAll()
|
||||
.antMatchers(adminContextPath + "/login").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
//配置登录和登出路径
|
||||
.formLogin().loginPage(adminContextPath + "/login").and()
|
||||
.logout().logoutUrl(adminContextPath + "/logout").and()
|
||||
//开启http basic支持,admin-client注册时需要使用
|
||||
.httpBasic().and()
|
||||
.csrf()
|
||||
//开启基于cookie的csrf保护
|
||||
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
|
||||
//忽略这些路径的csrf保护以便admin-client注册
|
||||
.ignoringAntMatchers(
|
||||
adminContextPath + "/instances",
|
||||
adminContextPath + "/actuator/**"
|
||||
);
|
||||
}
|
||||
}
|
10
novel-monitor/src/main/resources/bootstrap.yml
Normal file
10
novel-monitor/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,10 @@
|
||||
spring:
|
||||
application:
|
||||
name: novel-monitor
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: 47.106.243.172:8848
|
||||
file-extension: yml
|
||||
group: dev
|
||||
namespace: af61b0e1-4581-4d1e-a04b-efe55137a0b1
|
Reference in New Issue
Block a user