Polish
This commit is contained in:
@@ -364,6 +364,7 @@ public class EndpointWebMvcChildContextConfiguration {
|
||||
}
|
||||
|
||||
abstract void customize(T container);
|
||||
|
||||
}
|
||||
|
||||
static class TomcatAccessLogCustomizer
|
||||
|
||||
@@ -188,8 +188,9 @@ public class HealthMvcEndpoint extends AbstractEndpointMvcAdapter<HealthEndpoint
|
||||
}
|
||||
if (isSpringSecurityAuthentication(principal)) {
|
||||
Authentication authentication = (Authentication) principal;
|
||||
List<String> roles = Arrays.asList(StringUtils.trimArrayElements(StringUtils
|
||||
.commaDelimitedListToStringArray(this.roleResolver.getProperty("roles", "ROLE_ADMIN"))));
|
||||
List<String> roles = Arrays.asList(StringUtils
|
||||
.trimArrayElements(StringUtils.commaDelimitedListToStringArray(
|
||||
this.roleResolver.getProperty("roles", "ROLE_ADMIN"))));
|
||||
for (GrantedAuthority authority : authentication.getAuthorities()) {
|
||||
String name = authority.getAuthority();
|
||||
for (String role : roles) {
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link EndpointWebMvcHypermediaManagementContextConfigurationTests}.
|
||||
* Tests for {@link EndpointWebMvcHypermediaManagementContextConfiguration}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
|
||||
@@ -60,15 +60,18 @@ public class HealthMvcEndpointTests {
|
||||
|
||||
private MockEnvironment environment;
|
||||
|
||||
private UsernamePasswordAuthenticationToken user = createAuthenticationToken("ROLE_USER");
|
||||
private UsernamePasswordAuthenticationToken user = createAuthenticationToken(
|
||||
"ROLE_USER");
|
||||
|
||||
private UsernamePasswordAuthenticationToken admin = createAuthenticationToken("ROLE_ADMIN");
|
||||
private UsernamePasswordAuthenticationToken admin = createAuthenticationToken(
|
||||
"ROLE_ADMIN");
|
||||
|
||||
private UsernamePasswordAuthenticationToken hero = createAuthenticationToken("ROLE_HERO");
|
||||
private UsernamePasswordAuthenticationToken hero = createAuthenticationToken(
|
||||
"ROLE_HERO");
|
||||
|
||||
private UsernamePasswordAuthenticationToken createAuthenticationToken(String authority) {
|
||||
return new UsernamePasswordAuthenticationToken(
|
||||
"user", "password",
|
||||
private UsernamePasswordAuthenticationToken createAuthenticationToken(
|
||||
String authority) {
|
||||
return new UsernamePasswordAuthenticationToken("user", "password",
|
||||
AuthorityUtils.commaSeparatedStringToAuthorityList(authority));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user