我在端口 6565 上有/actuator/端点(在我的情况下是manage)。是否可以仅对特定端口禁用 Spring Boot 2 中的安全性?目前我只能从安全中排除某些路径。如果我现在在 /manage/ 下的主应用程序端口 1337 下运行 Enpoints,那将是不安全的。过去我们使用management.security.enabled: false还是该路径也相关?
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/manage/**").permitAll()
.anyRequest().authenticated().and().httpBasic().realmName("Hay, the Config Server is here");
}
}
Run Code Online (Sandbox Code Playgroud)
应用程序.yml
spring:
cloud:
config:
server:
git:
uri: https://bitbucket.xxx.net/scm/gpi/springconfiguration.git
username: xxx
password: xxx
searchPaths: application-*
force-pull: true
security:
user:
name: xxxUser
password: xxx
server:
port: 1337
address: 0.0.0.0
management:
server:
port: 6565
metrics:
export:
prometheus: …Run Code Online (Sandbox Code Playgroud)