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:
@@ -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()
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoint.health.show-details=true
|
||||
|
||||
@@ -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\"");
|
||||
}
|
||||
|
||||
@@ -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\"");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user