Enable actuator discovery
This commit is contained in:
committed by
Soby Chacko
parent
dfeedf4338
commit
451d962eee
@@ -61,7 +61,7 @@ public class AppStarterWebFluxSecurityAutoConfiguration {
|
||||
.permitAll();
|
||||
}
|
||||
else {
|
||||
http.authorizeExchange().pathMatchers("/actuator/health", "/actuator/info", "/actuator/bindings")
|
||||
http.authorizeExchange().pathMatchers("/actuator", "/actuator/health", "/actuator/info", "/actuator/bindings")
|
||||
.permitAll().anyExchange().authenticated();
|
||||
http.httpBasic();
|
||||
http.formLogin();
|
||||
|
||||
@@ -60,6 +60,7 @@ public class AppStarterWebSecurityAutoConfiguration {
|
||||
}
|
||||
if (securityProperties.isEnabled()) {
|
||||
http.authorizeRequests()
|
||||
.requestMatchers(EndpointRequest.toLinks()).permitAll()
|
||||
.requestMatchers(EndpointRequest.to("health", "info", "bindings")).permitAll()
|
||||
.requestMatchers(EndpointRequest.toAnyEndpoint()).authenticated()
|
||||
.and().formLogin().and().httpBasic();
|
||||
|
||||
@@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@TestPropertySource(properties = {
|
||||
"spring.main.web-application-type=reactive",
|
||||
"management.endpoints.web.discovery.enabled=true",
|
||||
"management.endpoints.web.exposure.include=health,info,env,bindings",
|
||||
"info.name=MY TEST APP"})
|
||||
public class ReactiveSecurityEnabledManagementSecurityEnabledTests extends AbstractSecurityCommonTests {
|
||||
@@ -57,6 +58,13 @@ public class ReactiveSecurityEnabledManagementSecurityEnabledTests extends Abstr
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testDiscoveryEndpoint() {
|
||||
ResponseEntity<Map> response = this.restTemplate.getForEntity("/actuator", Map.class);
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testBindingsEndpoint() {
|
||||
|
||||
@@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@TestPropertySource(properties = {
|
||||
"spring.main.web-application-type=servlet",
|
||||
"management.endpoints.web.discovery.enabled=true",
|
||||
"management.endpoints.web.exposure.include=health,info,env",
|
||||
"info.name=MY TEST APP"})
|
||||
public class SecurityEnabledManagementSecurityEnabledTests extends AbstractSecurityCommonTests {
|
||||
@@ -54,6 +55,13 @@ public class SecurityEnabledManagementSecurityEnabledTests extends AbstractSecur
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testDiscoveryEndpoint() {
|
||||
ResponseEntity<Map> response = this.restTemplate.getForEntity("/actuator", Map.class);
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
// The ManagementWebSecurityAutoConfiguration exposes only Info and Health endpoint not Env!
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
Reference in New Issue
Block a user