添加admin 监控
parent
aaf4a121ec
commit
c6ae35354d
|
|
@ -56,6 +56,12 @@
|
|||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -57,4 +57,15 @@ mystyle:
|
|||
- /doc.html
|
||||
- /webjars/**
|
||||
#
|
||||
- /upload/decoToken
|
||||
- /upload/decoToken
|
||||
- /actuator/**
|
||||
- /instances/**
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
enabled: true
|
||||
|
|
@ -101,5 +101,11 @@
|
|||
<groupId>com.artofsolving</groupId>
|
||||
<artifactId>jodconverter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -66,4 +66,15 @@ mystyle:
|
|||
- /doc.html
|
||||
- /webjars/**
|
||||
#
|
||||
- /upload/decoToken
|
||||
- /upload/decoToken
|
||||
- /actuator/**
|
||||
- /instances/**
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
enabled: true
|
||||
|
|
@ -52,6 +52,12 @@
|
|||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -83,4 +83,13 @@ spring:
|
|||
predicates:
|
||||
- Path=/mystyle-cloud-admin-monitor/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
- StripPrefix=1
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
enabled: true
|
||||
|
|
|
|||
|
|
@ -52,5 +52,11 @@
|
|||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -85,6 +85,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
|||
http.authorizeRequests()
|
||||
// 跨域预检请求
|
||||
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||
.antMatchers(securityProperty.getOpenApi()).permitAll()
|
||||
.anyRequest().
|
||||
authenticated(); // 其他地址需要认证授权
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,4 +62,14 @@ mapper:
|
|||
mystyle:
|
||||
security:
|
||||
open-api:
|
||||
- /
|
||||
- /actuator/**
|
||||
- /instances/**
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
enabled: true
|
||||
|
|
@ -75,6 +75,10 @@
|
|||
<artifactId>mystyle-cloud-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.zhangmeng.oauth.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author 转身的背影在心底里沉沦
|
||||
* @date 2021年9月14日16:50:47
|
||||
* @version 1.0
|
||||
* */
|
||||
@Configuration
|
||||
@ConfigurationProperties("mystyle.security")
|
||||
public class SecurityProperty {
|
||||
|
||||
/**
|
||||
* 超级管理员不认证
|
||||
* */
|
||||
private boolean superAuthOpen;
|
||||
|
||||
/**
|
||||
* 不验证权限用户名
|
||||
* */
|
||||
private String superAdmin;
|
||||
|
||||
/**
|
||||
* 记住密码标识
|
||||
* */
|
||||
private String rememberKey;
|
||||
|
||||
/**
|
||||
* 开放接口列表
|
||||
* */
|
||||
private String[] openApi;
|
||||
|
||||
/**
|
||||
* 是否允许多账号在线
|
||||
* */
|
||||
private Integer maximum = 1;
|
||||
|
||||
public boolean isSuperAuthOpen() {
|
||||
return superAuthOpen;
|
||||
}
|
||||
|
||||
public void setSuperAuthOpen(boolean superAuthOpen) {
|
||||
this.superAuthOpen = superAuthOpen;
|
||||
}
|
||||
|
||||
public String getSuperAdmin() {
|
||||
return superAdmin;
|
||||
}
|
||||
|
||||
public void setSuperAdmin(String superAdmin) {
|
||||
this.superAdmin = superAdmin;
|
||||
}
|
||||
|
||||
public String getRememberKey() {
|
||||
return rememberKey;
|
||||
}
|
||||
|
||||
public void setRememberKey(String rememberKey) {
|
||||
this.rememberKey = rememberKey;
|
||||
}
|
||||
|
||||
public String[] getOpenApi() {
|
||||
return openApi;
|
||||
}
|
||||
|
||||
public void setOpenApi(String[] openApi) {
|
||||
this.openApi = openApi;
|
||||
}
|
||||
|
||||
public Integer getMaximum() {
|
||||
return maximum;
|
||||
}
|
||||
|
||||
public void setMaximum(Integer maximum) {
|
||||
this.maximum = maximum;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zhangmeng.oauth.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
|
@ -18,6 +19,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||
@Order(-1)
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SecurityProperty securityProperty;
|
||||
|
||||
/***
|
||||
* 采用BCryptPasswordEncoder对密码进行编码
|
||||
* @return
|
||||
|
|
@ -35,11 +40,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
// 对静态资源放行
|
||||
web.ignoring().antMatchers(
|
||||
"/user/login",
|
||||
"/user/logout",
|
||||
"/oauth/login","/user/oauth/parseToken"
|
||||
);
|
||||
web.ignoring().antMatchers(securityProperty.getOpenApi());
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
|||
|
|
@ -52,4 +52,22 @@ feign:
|
|||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
read-timeout: 20000
|
||||
mystyle:
|
||||
security:
|
||||
open-api:
|
||||
- /user/login
|
||||
- /user/logout
|
||||
- /oauth/login
|
||||
- /user/oauth/parseToken
|
||||
- /actuator/**
|
||||
- /instances/**
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
enabled: true
|
||||
|
|
@ -51,5 +51,11 @@
|
|||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -85,6 +85,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
|||
http.authorizeRequests()
|
||||
// 跨域预检请求
|
||||
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||
.antMatchers(securityProperty.getOpenApi()).permitAll()
|
||||
.anyRequest().
|
||||
authenticated(); // 其他地址需要认证授权
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,4 +65,18 @@ mapper:
|
|||
style: normal
|
||||
enum-as-simple-type: true
|
||||
identity: MYSQL
|
||||
check-example-entity-class: true
|
||||
check-example-entity-class: true
|
||||
mystyle:
|
||||
security:
|
||||
open-api:
|
||||
- /actuator/**
|
||||
- /instances/**
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
enabled: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue