我在我的应用程序中使用了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中启动应用程序时,我在日志文件中看到了默认密码。
发布于 2016-01-27 05:55:42
基本安全性是禁用的,但是Spring Boot会使用默认的用户/通行证配置身份验证管理器,即使在将security.basic.enabled设置为false之后也是如此。但基本安全性被禁用。您可以重新配置authenticationManager以覆盖此行为,如下所示:
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("me").password("secret").roles("ADMIN");
}
} 发布于 2016-09-28 15:14:41
您可以通过在application.yml中设置用户名/密码来停止spring boot以记录默认密码-
security:
basic:
enabled: false
user:
name: user
password: ****发布于 2021-03-25 23:04:03
如果Spring Security存在,您将需要添加自定义安全配置,以允许对端点进行未经身份验证的访问。类似于:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
//....
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(HttpMethod.GET, "/actuator/**");
super.configure(web);
}
}https://stackoverflow.com/questions/35023774
复制相似问题