From 2e926601f2e63dfaf76b44e1193d655baf35c176 Mon Sep 17 00:00:00 2001 From: Christian Dupuis Date: Mon, 18 Nov 2013 20:59:25 +0100 Subject: [PATCH] Polish --- .../boot/actuate/autoconfigure/CrshAutoConfiguration.java | 6 +++--- .../boot/actuate/properties/ShellProperties.java | 8 +++----- .../actuate/autoconfigure/CrshAutoConfigurationTests.java | 8 +++++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java index bc4c1761b2..d865453630 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java @@ -133,7 +133,7 @@ public class CrshAutoConfiguration { @Bean @ConditionalOnExpression("'${shell.auth:simple}' == 'spring'") @ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class }) - public CrshShellAuthenticationProperties SpringAuthenticationProperties() { + public CrshShellAuthenticationProperties springAuthenticationProperties() { return new SpringAuthenticationProperties(); } @@ -370,7 +370,7 @@ public class CrshAutoConfiguration { } /** - * {@link FSDriver} to expose Spring {@link Resource}s to CRaSH. + * {@link FSDriver} to wrap Spring's {@link Resource} abstraction to CRaSH. */ private static class SimpleFileSystemDriver extends AbstractFSDriver { @@ -466,7 +466,7 @@ public class CrshAutoConfiguration { } /** - * {@link ResourceHandle} for a file. + * {@link ResourceHandle} for a file backed by a Spring {@link Resource}. */ private static class FileHandle extends ResourceHandle { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java index 3e571ff462..e1d51a6f69 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java @@ -337,14 +337,12 @@ public class ShellProperties { public static class SpringAuthenticationProperties extends CrshShellAuthenticationProperties { - private String[] roles = new String[] { "ROLE_ADMIN" }; + private String[] roles = new String[] { "ADMIN" }; @Override protected void applyToCrshShellConfig(Properties config) { - if (this.roles != null) { - config.put("crash.auth.spring.roles", - StringUtils.arrayToCommaDelimitedString(this.roles)); - } + config.put("crash.auth.spring.roles", + StringUtils.arrayToCommaDelimitedString(this.roles)); } public void setRoles(String[] roles) { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java index 3084882f04..984d42b6b7 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java @@ -314,8 +314,8 @@ public class CrshAutoConfigurationTests { authentication = new UsernamePasswordAuthenticationToken( authentication.getPrincipal(), authentication.getCredentials(), - Collections.singleton(new SimpleGrantedAuthority( - "ROLE_ADMIN"))); + Collections + .singleton(new SimpleGrantedAuthority("ADMIN"))); } else { throw new BadCredentialsException("Invalid username and password"); @@ -328,7 +328,9 @@ public class CrshAutoConfigurationTests { @Bean public AccessDecisionManager accessDecisionManager() { List voters = new ArrayList(); - voters.add(new RoleVoter()); + RoleVoter voter = new RoleVoter(); + voter.setRolePrefix(""); + voters.add(voter); AccessDecisionManager result = new UnanimousBased(voters); return result; }