mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '1.4.x' into 1.5.x
# Conflicts: # spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java # spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java
This commit is contained in:
commit
3d9c56fbf3
@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.actuate.autoconfigure;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -178,7 +179,7 @@ public class ManagementServerProperties implements SecurityPrerequisite {
|
||||
/**
|
||||
* Comma-separated list of roles that can access the management endpoint.
|
||||
*/
|
||||
private List<String> roles = Collections.singletonList("ADMIN");
|
||||
private List<String> roles = new ArrayList<String>(Collections.singletonList("ADMIN"));
|
||||
|
||||
/**
|
||||
* Session creating policy to use (always, never, if_required, stateless).
|
||||
|
@ -80,6 +80,13 @@ public class ManagementServerPropertiesAutoConfigurationTests {
|
||||
assertThat(properties.getSecurity().getRoles()).containsOnly("FOO", "BAR", "BIZ");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void managementRolesAllowsIndexedAccess() {
|
||||
ManagementServerProperties properties = load(
|
||||
"management.security.roles[0]=FOO");
|
||||
assertThat(properties.getSecurity().getRoles()).containsOnly("FOO");
|
||||
}
|
||||
|
||||
public ManagementServerProperties load(String... environment) {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(ctx, environment);
|
||||
|
Loading…
Reference in New Issue
Block a user