Delegate shell access decision to bean named "shellAccessDecisionManager"

In order to solve issues with multiple or incompatible AccessDecisionManagers, the CRaSH integration will now only delegate to an explicit shellAccessDecisionManager bean refs #1121
pull/1128/merge
Christian Dupuis 11 years ago
parent 9d5c371cf1
commit b5d65bfc56

@ -43,6 +43,7 @@ import org.crsh.vfs.spi.AbstractFSDriver;
import org.crsh.vfs.spi.FSDriver; import org.crsh.vfs.spi.FSDriver;
import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.actuate.autoconfigure.ShellProperties.CrshShellAuthenticationProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.CrshShellAuthenticationProperties;
import org.springframework.boot.actuate.autoconfigure.ShellProperties.CrshShellProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.CrshShellProperties;
import org.springframework.boot.actuate.autoconfigure.ShellProperties.JaasAuthenticationProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.JaasAuthenticationProperties;
@ -280,6 +281,7 @@ public class CrshAutoConfiguration {
private AuthenticationManager authenticationManager; private AuthenticationManager authenticationManager;
@Autowired(required = false) @Autowired(required = false)
@Qualifier("shellAccessDecisionManager")
private AccessDecisionManager accessDecisionManager; private AccessDecisionManager accessDecisionManager;
private String[] roles = new String[] { "ADMIN" }; private String[] roles = new String[] { "ADMIN" };

@ -372,7 +372,7 @@ public class CrshAutoConfigurationTests {
} }
@Bean @Bean
public AccessDecisionManager accessDecisionManager() { public AccessDecisionManager shellAccessDecisionManager() {
List<AccessDecisionVoter> voters = new ArrayList<AccessDecisionVoter>(); List<AccessDecisionVoter> voters = new ArrayList<AccessDecisionVoter>();
RoleVoter voter = new RoleVoter(); RoleVoter voter = new RoleVoter();
voter.setRolePrefix(""); voter.setRolePrefix("");
@ -380,6 +380,7 @@ public class CrshAutoConfigurationTests {
AccessDecisionManager result = new UnanimousBased(voters); AccessDecisionManager result = new UnanimousBased(voters);
return result; return result;
} }
} }
} }

Loading…
Cancel
Save