当前位置: 首页 > 知识库问答 >
问题:

Spring引导器和Spring执行器-禁用安全

太叔栋
2023-03-14

我在我的应用程序中使用了Spring-Boot1.3.1和Spring-Boot-Actutor。我使用spring-boot-starter-parent作为pom.xml中的父级。

为了禁用安全性,我在application.yml中添加了2个条目。

security:
  basic:
    enabled: false
management:
  security:
    enabled: false

它仍然没有禁用基本的安全性。当我在本地Tomcat中启动应用程序时,我看到日志文件中的默认密码。

共有1个答案

邹弘
2023-03-14

基本安全性被禁用,但Spring Boot即使将security.Basic.enabled设置为false之后,也将身份验证管理器配置为默认的user/pass。但基本安全性被禁用。您可以重新配置authenticationManager以覆盖此行为,如下所示:

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    @Autowired
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth
                .inMemoryAuthentication()
                    .withUser("me").password("secret").roles("ADMIN");
    }
} 
 类似资料:
  • 我尝试在配置文件中禁用生产环境的所有执行器endpoint: 它适用于除/info以外的所有endpoint。如何关闭给定环境的所有endpoint? 更新: 我正在做的项目也是Eureka的客户。在Spring Cloud Netflix的文档Status Page and Health Indicator一节(http://Cloud.Spring.io/spring-cloud-netfli

  • 嗨,我正在使用sprinb-boot2中的致动器,具有以下属性 我的目标是禁用除健康之外的所有endpoint。通过此配置,我禁用了除health以外的所有endpoint,现在获取以下endpoint。是否可以同时禁用?怎么做的?

  • 我第一次使用Spring Boot应用程序时,执行器是不安全的,所以很容易通过/acture/shutdownendpoint远程关闭。最近,我已经使用Spring安全保护了我的执行器,它已经起作用了。现在我需要提供http基本凭据来访问endpoint,但现在对/acture/shutdownendpoint的curl调用失败,出现禁止错误。我一定是配置不正确的地方。 我的卷曲命令: 我的配置:

  • 我有一个使用spring Boot1.4.2和CXF JAXR的项目设置。我想把Spring引导执行器添加到项目中。这是我添加到项目中的配置。 在此之后创建一个WAR文件,然后将其部署在外部tomcat服务器中。但是当我访问健康URL localhost:8080/management/health时,它给出的是404 HTTP代码。服务器正常启动,我可以看到包含以下详细信息的日志: 运行状况配置

  • 我正在为我的Spring Boot应用程序实现自定义执行器HealthIndicators。 它们看起来像: 这里我的问题是,默认情况下,Acturet有大约5分钟的调度时间,在该时间内它将自动调用endpoint。我要禁用这个。 我只希望在代码中显式调用健康endpoint时调用它。 有人知道如何禁用执行器默认调度吗?

  • Spring Boot执行器的两个版本(1.2.5和1.3.0)在HealthMvcEndpoint,isUnrestricted()方法(&&and)中的实现存在差异。我明白这是为了保留这些限制 http://docs.spring.io/spring-boot/docs/current-snapshot/reference/htmlsingle/#production-ready-health