Polish
This commit is contained in:
parent
dba8c01035
commit
2e926601f2
|
@ -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<ResourceHandle> {
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<AccessDecisionVoter> voters = new ArrayList<AccessDecisionVoter>();
|
||||
voters.add(new RoleVoter());
|
||||
RoleVoter voter = new RoleVoter();
|
||||
voter.setRolePrefix("");
|
||||
voters.add(voter);
|
||||
AccessDecisionManager result = new UnanimousBased(voters);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue