fix: 修改health包名。

This commit is contained in:
tianyongbao
2025-01-15 22:59:07 +08:00
parent 34ccd2ed25
commit 9b9f3053e6
337 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
package com.intc.config;
import com.intc.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
/**
* @ClassName ActuatorSecurityConfig
* @Author YaphetS
* @Date 2023/3/14 9:18
* @Version 1.0
* @Description TODO
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class ActuatorSecurityConfig {
@Autowired
Environment env;
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
String contextPath = env.getProperty("management.endpoints.web.base-path");
if(StringUtils.isEmpty(contextPath)) {
contextPath = "/actuator";
}
http.csrf().disable();
http.authorizeRequests()
.antMatchers("/**"+contextPath+"/**")
.authenticated()
.anyRequest()
.permitAll()
.and()
.httpBasic();
return http.build();
}
}