EndpointRequest should check that the request is to the mgmt context

Fixes gh-15702
This commit is contained in:
Madhura Bhave
2019-02-19 16:34:28 -08:00
parent 59430a2642
commit c3e47541ad
5 changed files with 174 additions and 1 deletions

View File

@@ -56,6 +56,14 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
assertThat(entity.getBody()).contains("Hello World");
}
@Test
public void actuatorPathOnMainPortShouldNotMatch() {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.port + "/actuator/health",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
@Test
public void testSecureActuator() {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(