activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r660517 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/security/ test/java/org/apache/activemq/security/ test/resources/org/apache/activemq/security/
Date Tue, 27 May 2008 13:51:46 GMT
Author: rajdavies
Date: Tue May 27 06:51:42 2008
New Revision: 660517

URL: http://svn.apache.org/viewvc?rev=660517&view=rev
Log:
Apply patch for https://issues.apache.org/activemq/browse/AMQ-1747

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java?rev=660517&r1=660516&r2=660517&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
Tue May 27 06:51:42 2008
@@ -51,6 +51,12 @@
         if (securityContext == null) {
             throw new SecurityException("User is not authenticated.");
         }
+        
+        Destination existing = this.getDestinationMap().get(destination);
+        if (existing != null) {
+        	return existing;
+        }
+        
         // if(!((ActiveMQTempDestination)destination).getConnectionId().equals(context.getConnectionId().getValue())
         // ) {
         if (!securityContext.isBrokerContext()) {

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java?rev=660517&r1=660516&r2=660517&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
Tue May 27 06:51:42 2008
@@ -18,9 +18,16 @@
 
 import java.net.URI;
 
+import javax.jms.JMSException;
+import javax.jms.Message;
+
 import junit.framework.Test;
+
+import org.apache.activemq.CombinationTestSupport;
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.command.ActiveMQMessage;
+import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -44,5 +51,20 @@
         LOG.info("Loading broker configuration from the classpath with URI: " + uri);
         return BrokerFactory.createBroker(new URI("xbean:" + uri));
     }
+    
+    /**
+     * @see {@link CombinationTestSupport}
+     */
+    public void initCombosForTestPredefinedDestinations() {
+        addCombinationValues("userName", new Object[] {"guest"});
+        addCombinationValues("password", new Object[] {"password"});
+        addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST.Q")});
+    }
+    
+    public void testPredefinedDestinations() throws JMSException {
+    	Message sent = doSend(false);
+        assertEquals("guest", ((ActiveMQMessage)sent).getUserID());
+        assertEquals("guest", sent.getStringProperty("JMSXUserID"));
+    }
 
 }

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml?rev=660517&r1=660516&r2=660517&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml
Tue May 27 06:51:42 2008
@@ -23,6 +23,10 @@
 
   <broker useJmx="false" persistent="false" xmlns="http://activemq.apache.org/schema/core"
populateJMSXUserID="true">
 
+    <destinations>
+      <queue physicalName="TEST.Q" />      
+    </destinations> 
+
     <plugins>
 		<simpleAuthenticationPlugin>
 			<users>
@@ -44,6 +48,8 @@
               <authorizationEntry queue="USERS.>" read="users" write="users" admin="users"
/>
               <authorizationEntry queue="GUEST.>" read="guests" write="guests,users"
admin="guests,users" />
               
+              <authorizationEntry queue="TEST.Q" read="guests" write="guests" />
+              
               <authorizationEntry topic=">" read="admins" write="admins" admin="admins"
/>
               <authorizationEntry topic="USERS.>" read="users" write="users" admin="users"
/>
               <authorizationEntry topic="GUEST.>" read="guests" write="guests,users"
admin="guests,users" />



Mime
View raw message