ARTEMIS-1872 fix security tests

After the new authn change for creating addresses a bunch of tests need
to be updated to include the proper permissions.
This commit is contained in:
Justin Bertram 2018-05-24 11:34:34 -05:00 committed by Clebert Suconic
parent fd3baf1ea2
commit cd2f544b7e
4 changed files with 19 additions and 19 deletions

View File

@ -94,7 +94,7 @@ public class OpenWireTestBase extends ActiveMQTestBase {
securityManager.getConfiguration().addRole("openwireDestinationManager", "manager"); securityManager.getConfiguration().addRole("openwireDestinationManager", "manager");
securityManager.getConfiguration().addUser("openwireDestinationManager", "DeStInAtIoN"); securityManager.getConfiguration().addUser("openwireDestinationManager", "DeStInAtIoN");
Role destRole = new Role("manager", false, false, false, false, true, true, false, false, false, false); Role destRole = new Role("manager", false, false, false, false, true, true, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(senderRole); roles.add(senderRole);

View File

@ -1006,7 +1006,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1050,7 +1050,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, true, false, false, false, false, false, true); Role role = new Role("arole", false, false, true, true, false, false, false, false, true, true);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1069,7 +1069,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1096,7 +1096,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, false, false, false, false, false); Role role = new Role("arole", false, false, false, false, true, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1140,7 +1140,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, true, false, false, false, true); Role role = new Role("arole", false, false, false, false, true, true, false, false, true, true);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1159,7 +1159,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, false, false, false, false, false); Role role = new Role("arole", false, false, false, false, true, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1190,7 +1190,7 @@ public class SecurityTest extends ActiveMQTestBase {
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", true, true, true, false, false, false, false, false, false, false); Role role = new Role("arole", true, true, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
@ -1249,7 +1249,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1277,7 +1277,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles); securityRepository.addMatch(SecurityTest.addressA, roles);
@ -1304,7 +1304,7 @@ public class SecurityTest extends ActiveMQTestBase {
securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().setDefaultUser("guest");
Role role = new Role("arole", false, true, false, false, false, false, false, false, false, false); Role role = new Role("arole", false, true, false, false, false, false, false, false, false, false);
Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(sendRole); roles.add(sendRole);
roles.add(role); roles.add(role);
@ -1332,7 +1332,7 @@ public class SecurityTest extends ActiveMQTestBase {
securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().setDefaultUser("guest");
Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(sendRole); roles.add(sendRole);
roles.add(role); roles.add(role);
@ -1367,7 +1367,7 @@ public class SecurityTest extends ActiveMQTestBase {
securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().setDefaultUser("guest");
Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false); Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(sendRole); roles.add(sendRole);
@ -1416,7 +1416,7 @@ public class SecurityTest extends ActiveMQTestBase {
securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().setDefaultUser("guest");
Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false); Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(sendRole); roles.add(sendRole);
@ -1473,7 +1473,7 @@ public class SecurityTest extends ActiveMQTestBase {
securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().setDefaultUser("guest");
Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
System.out.println("guest:" + role); System.out.println("guest:" + role);
Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
System.out.println("guest:" + sendRole); System.out.println("guest:" + sendRole);
Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false); Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false);
System.out.println("guest:" + receiveRole); System.out.println("guest:" + receiveRole);
@ -1577,7 +1577,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles);
@ -1606,7 +1606,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass"); securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles);

View File

@ -60,7 +60,7 @@ public class ResourceLimitTest extends ActiveMQTestBase {
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("myUser", "password"); securityManager.getConfiguration().addUser("myUser", "password");
securityManager.getConfiguration().addRole("myUser", "arole"); securityManager.getConfiguration().addRole("myUser", "arole");
Role role = new Role("arole", false, false, false, false, true, true, false, true, false, true); Role role = new Role("arole", false, false, false, false, true, true, false, true, true, true);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(role); roles.add(role);
server.getSecurityRepository().addMatch("#", roles); server.getSecurityRepository().addMatch("#", roles);

View File

@ -128,7 +128,7 @@ public class DualAuthenticationTest extends ActiveMQTestBase {
server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager, false)); server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager, false));
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository(); HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, false, false); Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, true, false);
Role receiveRole = new Role("consumers", false, true, false, false, false, false, false, false, false, false); Role receiveRole = new Role("consumers", false, true, false, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>(); Set<Role> roles = new HashSet<>();
roles.add(sendRole); roles.add(sendRole);