+-

我在应用程序中使用 spring-boot 1.3.1和spring-boot-actuator.我在pom.xml中将spring-boot-starter-parent用作父项.
为了禁用安全性,我在application.yml中添加了2个条目.
security:
basic:
enabled: false
management:
security:
enabled: false
它仍然没有禁用基本安全性.在本地Tomcat中启动应用程序时,我在日志文件中看到默认密码.
最佳答案
基本安全性已禁用,但是即使将security.basic.enabled设置为false,Spring Boot也会使用默认用户/密码配置身份验证管理器.但是基本安全性被禁用.您可以重新配置authenticationManager以覆盖此行为,如下所示:
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("me").password("secret").roles("ADMIN");
}
}
点击查看更多相关文章
转载注明原文:Spring Boot和Spring Actuator-禁用安全性 - 乐贴网