0
@EnableWebSecurity
@Configuration
public class ActuatorSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
                .authorizeRequests()
                .antMatchers("/myapp/**")
                .authenticated()
                .anyRequest()
                .permitAll()
                .and()
                .formLogin();
    }
}

以下是 application.properties 中的属性

management.endpoint.health.show-details = always
management.security.enabled = true
management.endpoint.health.roles = ACTUATOR_ADMIN
management.endpoint.enabled-by-default = false
management.endpoint.web.exposure.include = *

spring.security.user.name = actuator
spring.security.user.password = actuator
spring.security.user.roles = ACTUATOR_ADMIN

security.basic.enabled = false

management.endpoints.web.base-path = /myapp
management.endpoints.web.path-mapping.health = health

我的 Spring Boot 应用程序具有此配置,用于启用带有表单登录的执行器。现在它在我的本地机器上工作得很好。在 PCF 上部署应用程序后,如果我尝试使用 pcf 的相关 URL 访问端点,则会出现 404 not found 错误。

我不了解或无法访问我们的 pcf 基础架构来找出问题所在。有人可以告诉我我在这里缺少什么。

4

0 回答 0