Drop status endpoint

Drop the status endpoint and merge functionality back into the health
endpoint. The `management.endpoint.health.show-details` property can
be used to change if full details, or just the status is displayed.

Fixes gh-11113
This commit is contained in:
Phillip Webb
2017-11-22 13:54:11 -08:00
parent d99625fa78
commit 31025d9f6c
32 changed files with 127 additions and 540 deletions

View File

@@ -41,7 +41,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http.authorizeRequests()
.requestMatchers(EndpointRequest.to("status", "info")).permitAll()
.requestMatchers(EndpointRequest.to("health", "info")).permitAll()
.requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole("ACTUATOR")
.requestMatchers(StaticResourceRequest.toCommonLocations()).permitAll()
.antMatchers("/foo").permitAll()

View File

@@ -1 +1,2 @@
management.endpoints.web.expose=*
management.endpoint.health.show-details=true

View File

@@ -57,9 +57,9 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
@Test
public void testSecureActuator() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate()
.getForEntity("http://localhost:" + this.managementPort
+ "/management/application/health", String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.managementPort + "/management/application/env",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
@@ -67,7 +67,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
public void testInsecureActuator() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate()
.getForEntity("http://localhost:" + this.managementPort
+ "/management/application/status", String.class);
+ "/management/application/health", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
}

View File

@@ -73,7 +73,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
@Test
public void insecureActuator() throws Exception {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/application/status", String.class);
.getForEntity("/application/health", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
}