diff options
| author | Robert Gemmell <robbie@apache.org> | 2009-10-21 11:38:44 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2009-10-21 11:38:44 +0000 |
| commit | 1b3706a481def9e8e685d5f6488c3f8051fd0201 (patch) | |
| tree | 76518d07e93402c274f665e2e39f225d7fc0b05b /java | |
| parent | 6b20198b5058dfc11233b9c93f344b8391fdde86 (diff) | |
| download | qpid-python-1b3706a481def9e8e685d5f6488c3f8051fd0201.tar.gz | |
QPID-1304: update ACL test + configuration file to use a static ACL configuration (with a secondary virtualhost)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@827967 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/systests/etc/config-systests-acl-settings.xml | 20 | ||||
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java | 16 |
2 files changed, 30 insertions, 6 deletions
diff --git a/java/systests/etc/config-systests-acl-settings.xml b/java/systests/etc/config-systests-acl-settings.xml index 418fada422..d7c1ef70df 100644 --- a/java/systests/etc/config-systests-acl-settings.xml +++ b/java/systests/etc/config-systests-acl-settings.xml @@ -134,6 +134,26 @@ </security> </test> </virtualhost> + + <virtualhost> + <name>test2</name> + <test2> + <security> + <access> + <class>org.apache.qpid.server.security.access.plugins.SimpleXML</class> + </access> + + <access_control_list> + <!-- This section grants specific users full permissions to all artifacts in this virtualhost --> + <access> + <users> + <user>guest</user> + </users> + </access> + </access_control_list> + </security> + </test2> + </virtualhost> </virtualhosts> </broker> diff --git a/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java b/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java index 45675998b2..b3a4196018 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java @@ -26,9 +26,11 @@ import org.apache.qpid.AMQException; import org.apache.qpid.AMQConnectionFailureException; import org.apache.qpid.client.AMQAuthenticationException; import org.apache.qpid.client.AMQConnection; +import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.client.AMQSession; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.jms.ConnectionListener; +import org.apache.qpid.jms.ConnectionURL; import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.url.URLSyntaxException; @@ -119,17 +121,19 @@ public class SimpleACLTest extends QpidTestCase implements ConnectionListener public void testAccessVhostAuthorisedGuest() throws IOException, Exception { - //The 'guest' user normally has no access, as tested below in testAccessNoRights(), and so is unable to perform - //actions such as connecting (and by extension, creating a queue, and consuming from a queue etc). In order to test - //the vhost-wide 'access' right, we will now give the guest user 'access' ACL rights and perform various such actions. - setConfigurationProperty("virtualhosts.virtualhost.test.security.access_control_list.access.users.user", "guest"); + //The 'guest' user has no access to the 'test' vhost, as tested below in testAccessNoRights(), and so + //is unable to perform actions such as connecting (and by extension, creating a queue, and consuming + //from a queue etc). In order to test the vhost-wide 'access' ACL right, the 'guest' user has been given + //this right in the 'test2' vhost. setUpACLTest(); try { - //get a connection - Connection conn = getConnection("guest", "guest"); + //get a connection to the 'test2' vhost using the guest user and perform various actions. + Connection conn = getConnection(new AMQConnectionURL( + "amqp://username:password@clientid/test2?brokerlist='" + getBroker() + "'")); + ((AMQConnection) conn).setConnectionListener(this); Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); |
