Spring boot 禁用Springboot执行器端点/环境的安全性

Spring boot 禁用Springboot执行器端点/环境的安全性,spring-boot,spring-security,Spring Boot,Spring Security,要求: 我有一个小的SpringBoot2配置服务器项目,只有一个java文件(SpringBootApplication)。我的要求是执行器端点/执行器/env本身不应受到spring安全性的挑战 我能做什么: 我可以通过使用http.csrf().disable().authorizeRequests().antMatchers(“/exactor/health”).permitAll()绕过/exactor/health的安全性,这样打开该链接就不会询问凭据 我想做什么: 但是如果我对/e

要求:
我有一个小的SpringBoot2配置服务器项目,只有一个java文件(SpringBootApplication)。我的要求是执行器端点/执行器/env本身不应受到spring安全性的挑战

我能做什么:
我可以通过使用http.csrf().disable().authorizeRequests().antMatchers(“/exactor/health”).permitAll()绕过/exactor/health的安全性,这样打开该链接就不会询问凭据

我想做什么:
但是如果我对/env(
.antMatchers(“/exactor/env”).permitAll()
)执行相同的操作,它仍然会显示默认的spring安全凭据页面。请帮忙

在application.yml中配置执行器
管理:
端点:
网状物:
基本路径/执行器
暴露:
包括:卫生、环境
终点:
健康:
显示详细信息:始终

安全配置:

`@Configuration
@EnableWebSecurity
public class SecurityConfigurer extends WebSecurityConfigurerAdapter {
    @Override
    public void configure(HttpSecurity http) throws Exception{
        http.csrf().disable().authorizeRequests()
        .antMatchers("/actuator/env").permitAll()
        .antMatchers("/actuator/env/**").permitAll()
        .antMatchers("/actuator/health").permitAll();
        super.configure(http);
    }
}`

/exactor/env默认情况下禁用端点。您需要将其包括在应用程序中。属性:

management.endpoints.web.exposure.include=env
还包括:

http.csrf().disable().authorizeRequests().antMatchers("/actuator/**").permitAll();

是否允许在/exactor path下执行任何操作

好的,我将在几分钟内更新完整的安全配置/env在成功身份验证后正常工作,无任何错误。另外,因为我在本地运行,所以我随身携带了控制台。没有抛出错误。您没有按照我建议的方式使用antMatchers(“/actuator/**”),但是您的安全配置应该可以工作。错误一定在别的地方