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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user