Update Actuator to use the new endpoint infrastructure

This commit migrates the Actuator onto the new endpoint infrastruture.
In addition to the existing support for accessing the endpoints via
JMX and HTTP using Spring MVC, support for access via HTTP using
Jersey and WebFlux has been added. This includes using a separate
management port where we now spin up an additional, appropriately
configured servlet or reactive web server to expose the management
context on a different HTTP port to the main application.

Closes gh-2921
Closes gh-5389
Closes gh-9796
This commit is contained in:
Andy Wilkinson
2017-07-12 09:08:43 +01:00
parent e92cb115e3
commit ee16332745
195 changed files with 7762 additions and 11963 deletions

View File

@@ -105,8 +105,8 @@ public class SampleMethodSecurityApplicationTests {
@Test
public void testManagementProtected() throws Exception {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/beans",
String.class);
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/application/beans", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
@@ -116,8 +116,8 @@ public class SampleMethodSecurityApplicationTests {
"admin", "admin");
this.restTemplate.getRestTemplate().getInterceptors().add(basicAuthInterceptor);
try {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/beans",
String.class);
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/application/beans", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
finally {
@@ -126,22 +126,6 @@ public class SampleMethodSecurityApplicationTests {
}
}
@Test
public void testManagementUnauthorizedAccess() throws Exception {
BasicAuthorizationInterceptor basicAuthInterceptor = new BasicAuthorizationInterceptor(
"user", "user");
this.restTemplate.getRestTemplate().getInterceptors().add(basicAuthInterceptor);
try {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/beans",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
}
finally {
this.restTemplate.getRestTemplate().getInterceptors()
.remove(basicAuthInterceptor);
}
}
private void getCsrf(MultiValueMap<String, String> form, HttpHeaders headers) {
ResponseEntity<String> page = this.restTemplate.getForEntity("/login",
String.class);