activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r891790 - in /activemq/branches/activemq-5.3/activemq-core/src: main/java/org/apache/activemq/security/ test/java/org/apache/activemq/security/ test/resources/org/apache/activemq/security/
Date Thu, 17 Dec 2009 16:26:07 GMT
Author: dejanb
Date: Thu Dec 17 16:26:01 2009
New Revision: 891790

URL: http://svn.apache.org/viewvc?rev=891790&view=rev
Log:
merging 891786 - https://issues.apache.org/activemq/browse/AMQ-2539 - adding temp destinations
and security

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

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java?rev=891790&r1=891789&r2=891790&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
Thu Dec 17 16:26:01 2009
@@ -28,6 +28,7 @@
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.command.ConsumerInfo;
+import org.apache.activemq.command.DestinationInfo;
 import org.apache.activemq.command.Message;
 import org.apache.activemq.command.ProducerInfo;
 
@@ -45,6 +46,11 @@
         super(next);
         this.authorizationMap = authorizationMap;
     }
+           
+    public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws
Exception {
+        addDestination(context, info.getDestination());
+        super.addDestinationInfo(context, info);
+    }
 
     public Destination addDestination(ConnectionContext context, ActiveMQDestination destination)
throws Exception {
         final SecurityContext securityContext = (SecurityContext)context.getSecurityContext();

Modified: activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java?rev=891790&r1=891789&r2=891790&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/security/SimpleAuthenticationPluginTest.java
Thu Dec 17 16:26:01 2009
@@ -18,14 +18,20 @@
 
 import java.net.URI;
 
+import javax.jms.Connection;
 import javax.jms.JMSException;
 import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.TemporaryTopic;
+import javax.management.ObjectName;
 
 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.broker.jmx.TopicViewMBean;
 import org.apache.activemq.command.ActiveMQMessage;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.commons.logging.Log;
@@ -66,5 +72,24 @@
         assertEquals("guest", ((ActiveMQMessage)sent).getUserID());
         assertEquals("guest", sent.getStringProperty("JMSXUserID"));
     }
+    
+    public void testTempDestinations() throws Exception {
+        Connection conn = factory.createConnection("guest", "password");
+        Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        String name = "org.apache.activemq:BrokerName=localhost,Type=TempTopic";
+        try {
+            conn.start();
+            TemporaryTopic temp = sess.createTemporaryTopic();
+            name += ",Destination=" + temp.getTopicName().replaceAll(":", "_");
+            fail("Should have failed creating a temp topic");
+        } catch (Exception ignore) {}
+        
+        ObjectName objName = new ObjectName(name);
+        TopicViewMBean mbean = (TopicViewMBean)broker.getManagementContext().newProxyInstance(objName,
TopicViewMBean.class, true);
+        try {
+            System.out.println(mbean.getName());
+            fail("Shouldn't have created a temp topic");
+        } catch (Exception ignore) {}
+    }
 
 }

Modified: activemq/branches/activemq-5.3/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml?rev=891790&r1=891789&r2=891790&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml
Thu Dec 17 16:26:01 2009
@@ -60,6 +60,9 @@
               
               <authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users"
admin="guests,users"/>
             </authorizationEntries>
+            <tempDestinationAuthorizationEntry>  
+                <tempDestinationAuthorizationEntry read="admin" write="admin" admin="admin"/>

+            </tempDestinationAuthorizationEntry>     
           </authorizationMap>
         </map>
       </authorizationPlugin>



Mime
View raw message