[jboss-cvs] JBoss Messaging SVN: r2793 - in trunk: tests/src/org/jboss/test/messaging/jms and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 20 08:36:39 EDT 2007
Author: sergeypk
Date: 2007-06-20 08:36:38 -0400 (Wed, 20 Jun 2007)
New Revision: 2793
Modified:
trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java
trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-994
Permission check will be skipped on temporary destinations.
Modified: trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java 2007-06-19 23:20:44 UTC (rev 2792)
+++ trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java 2007-06-20 12:36:38 UTC (rev 2793)
@@ -216,6 +216,14 @@
private void check(Destination dest, CheckType checkType, ServerConnectionEndpoint conn)
throws JMSSecurityException
{
+ JBossDestination jbd = (JBossDestination)dest;
+
+ if (jbd.isTemporary())
+ {
+ if (trace) { log.trace("skipping permission check on temporary destination " + dest); }
+ return;
+ }
+
if (trace) { log.trace("checking access permissions to " + dest); }
if (checkCached(dest, checkType))
@@ -224,7 +232,6 @@
return;
}
- JBossDestination jbd = (JBossDestination)dest;
boolean isQueue = jbd.isQueue();
String name = jbd.getName();
Modified: trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2007-06-19 23:20:44 UTC (rev 2792)
+++ trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2007-06-20 12:36:38 UTC (rev 2793)
@@ -880,7 +880,17 @@
}
}
}
+
+ public void testSecurityForTemporaryQueue() throws Exception
+ {
+ testSecurityForTemporaryDestination(true);
+ }
+ public void testSecurityForTemporaryTopic() throws Exception
+ {
+ testSecurityForTemporaryDestination(false);
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -926,9 +936,7 @@
ServerManagement.undeployTopic("unsecuredTopic");
ServerManagement.deployTopic("unsecuredTopic");
-
-
-
+
final String defaultSecurityConfig =
"<security><role name=\"def\" read=\"true\" write=\"true\" create=\"true\"/></security>";
oldDefaultConfig = ServerManagement.getDefaultSecurityConfig();
@@ -1033,6 +1041,54 @@
}
}
+ private void testSecurityForTemporaryDestination(boolean isQueue) throws Exception
+ {
+ Destination dest = isQueue ? (Destination) testQueue : testTopic;
+
+ Connection conn = cf.createConnection("guest", "guest");
+ try
+ {
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Destination temporaryDestination = isQueue
+ ? (Destination) session.createTemporaryQueue()
+ : session.createTemporaryTopic();
+ Message message = session.createMessage();
+ message.setJMSReplyTo(temporaryDestination);
+ MessageProducer producer = session.createProducer(dest);
+
+ MessageConsumer tmpConsumer = session.createConsumer(temporaryDestination);
+ conn.start();
+
+ Connection conn2 = cf.createConnection("john", "needle");
+ try
+ {
+ Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(dest);
+ conn.start();
+
+ producer.send(message);
+
+ Message in = consumer.receive(1000L);
+ assertNotNull(in);
+
+ Message out = session2.createMessage();
+ MessageProducer replyProducer = session2.createProducer(in.getJMSReplyTo());
+ replyProducer.send(out);
+ }
+ finally
+ {
+ conn2.close();
+ }
+
+ Message reply = tmpConsumer.receive(1000L);
+ assertNotNull(reply);
+ }
+ finally
+ {
+ conn.close();
+ }
+ }
+
// Inner classes -------------------------------------------------
}
More information about the jboss-cvs-commits
mailing list