JBoss hornetq SVN: r9234 - trunk/native.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-05-14 15:26:58 -0400 (Fri, 14 May 2010)
New Revision: 9234
Removed:
trunk/native/build-aux/
Log:
cleanup
14 years, 10 months
JBoss hornetq SVN: r9233 - in trunk/native: src and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-05-14 15:02:48 -0400 (Fri, 14 May 2010)
New Revision: 9233
Added:
trunk/native/cleanup-native
Modified:
trunk/native/src/JNI_AsynchronousFileImpl.cpp
trunk/native/src/Version.h
Log:
https://jira.jboss.org/jira/browse/HORNETQ-387 - using ByteBuffer for pointers
Added: trunk/native/cleanup-native
===================================================================
--- trunk/native/cleanup-native (rev 0)
+++ trunk/native/cleanup-native 2010-05-14 19:02:48 UTC (rev 9233)
@@ -0,0 +1,19 @@
+rm -r *log
+rm -r autom4te.cache
+rm -r aclocal.m4
+rm -r config.h
+rm -r config.in
+rm -r config.status
+rm -r configure
+rm -r libtool
+rm -r Makefile
+rm -r Makefile.in
+rm -r stamp-h1
+rm -r ./src/Makefile
+rm -r ./src/Makefile.in
+rm -r ./src/*.o
+rm -r ./src/.deps
+rm -r ./src/.libs
+rm -r ./src/org_hornetq_core_asyncio_impl_AsynchronousFileImpl.h
+rm -r ./src/disktest
+
Modified: trunk/native/src/JNI_AsynchronousFileImpl.cpp
===================================================================
--- trunk/native/src/JNI_AsynchronousFileImpl.cpp 2010-05-14 07:31:51 UTC (rev 9232)
+++ trunk/native/src/JNI_AsynchronousFileImpl.cpp 2010-05-14 19:02:48 UTC (rev 9233)
@@ -33,13 +33,19 @@
// This value is set here globally, to avoid passing stuff on stack between java and the native layer on every sleep call
struct timespec nanoTime;
+inline AIOController * getController(JNIEnv *env, jobject & controllerAddress)
+{
+ return (AIOController *) env->GetDirectBufferAddress(controllerAddress);
+}
+
+
/*
* Class: org_jboss_jaio_libaioimpl_LibAIOController
* Method: init
* Signature: (Ljava/lang/String;Ljava/lang/Class;)J
*/
-JNIEXPORT jlong JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_init
+JNIEXPORT jobject JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_init
(JNIEnv * env, jclass clazz, jstring jstrFileName, jint maxIO, jobject logger)
{
AIOController * controller = 0;
@@ -65,7 +71,7 @@
// controller->log(env,4, "Controller initialized");
- return (jlong)controller;
+ return env->NewDirectByteBuffer(controller, 0);
}
catch (AIOException& e){
if (controller != 0)
@@ -78,11 +84,11 @@
}
JNIEXPORT void JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_read
- (JNIEnv *env, jobject objThis, jlong controllerAddress, jlong position, jlong size, jobject jbuffer, jobject callback)
+ (JNIEnv *env, jobject objThis, jobject controllerAddress, jlong position, jlong size, jobject jbuffer, jobject callback)
{
try
{
- AIOController * controller = (AIOController *) controllerAddress;
+ AIOController * controller = getController(env, controllerAddress);
void * buffer = env->GetDirectBufferAddress(jbuffer);
if (buffer == 0)
@@ -166,11 +172,11 @@
}
JNIEXPORT void JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_write
- (JNIEnv *env, jobject objThis, jlong controllerAddress, jlong sequence, jlong position, jlong size, jobject jbuffer, jobject callback)
+ (JNIEnv *env, jobject objThis, jobject controllerAddress, jlong sequence, jlong position, jlong size, jobject jbuffer, jobject callback)
{
try
{
- AIOController * controller = (AIOController *) controllerAddress;
+ AIOController * controller = getController(env, controllerAddress);
void * buffer = env->GetDirectBufferAddress(jbuffer);
if (buffer == 0)
@@ -193,11 +199,11 @@
JNIEXPORT void Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_internalPollEvents
- (JNIEnv *env, jclass, jlong controllerAddress)
+ (JNIEnv *env, jclass, jobject controllerAddress)
{
try
{
- AIOController * controller = (AIOController *) controllerAddress;
+ AIOController * controller = getController(env, controllerAddress);
controller->fileOutput.pollEvents(env);
}
catch (AIOException& e)
@@ -207,11 +213,11 @@
}
JNIEXPORT void JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_stopPoller
- (JNIEnv *env, jclass, jlong controllerAddress)
+ (JNIEnv *env, jclass, jobject controllerAddress)
{
try
{
- AIOController * controller = (AIOController *) controllerAddress;
+ AIOController * controller = getController(env, controllerAddress);
controller->fileOutput.stopPoller(env);
}
catch (AIOException& e)
@@ -221,16 +227,13 @@
}
JNIEXPORT void JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_closeInternal
- (JNIEnv *env, jclass, jlong controllerAddress)
+ (JNIEnv *env, jclass, jobject controllerAddress)
{
try
{
- if (controllerAddress != 0)
- {
- AIOController * controller = (AIOController *) controllerAddress;
- controller->destroy(env);
- delete controller;
- }
+ AIOController * controller = getController(env, controllerAddress);
+ controller->destroy(env);
+ delete controller;
}
catch (AIOException& e)
{
@@ -240,11 +243,11 @@
JNIEXPORT void JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_fill
- (JNIEnv * env, jclass, jlong controllerAddress, jlong position, jint blocks, jlong size, jbyte fillChar)
+ (JNIEnv * env, jclass, jobject controllerAddress, jlong position, jint blocks, jlong size, jbyte fillChar)
{
try
{
- AIOController * controller = (AIOController *) controllerAddress;
+ AIOController * controller = getController(env, controllerAddress);
controller->fileOutput.preAllocate(env, position, blocks, size, fillChar);
@@ -267,11 +270,11 @@
JNIEXPORT jlong JNICALL Java_org_hornetq_core_asyncio_impl_AsynchronousFileImpl_size0
- (JNIEnv * env, jobject, jlong controllerAddress)
+ (JNIEnv * env, jobject, jobject controllerAddress)
{
try
{
- AIOController * controller = (AIOController *) controllerAddress;
+ AIOController * controller = getController(env, controllerAddress);
long size = controller->fileOutput.getSize();
if (size < 0)
Modified: trunk/native/src/Version.h
===================================================================
--- trunk/native/src/Version.h 2010-05-14 07:31:51 UTC (rev 9232)
+++ trunk/native/src/Version.h 2010-05-14 19:02:48 UTC (rev 9233)
@@ -3,6 +3,6 @@
// This definition needs to match org.hornetq.core.asyncio.impl.AsynchronousFileImpl.EXPECTED_NATIVE_VERSION
// Or else the native module won't be loaded because of version mismatches
-#define _VERSION_NATIVE_AIO 28
+#define _VERSION_NATIVE_AIO 29
#endif
14 years, 10 months
JBoss hornetq SVN: r9232 - branches/HnetQ_323_cn/docs/user-manual/zh.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2010-05-14 03:31:51 -0400 (Fri, 14 May 2010)
New Revision: 9232
Modified:
branches/HnetQ_323_cn/docs/user-manual/zh/security.xml
Log:
update
Modified: branches/HnetQ_323_cn/docs/user-manual/zh/security.xml
===================================================================
--- branches/HnetQ_323_cn/docs/user-manual/zh/security.xml 2010-05-14 00:11:11 UTC (rev 9231)
+++ branches/HnetQ_323_cn/docs/user-manual/zh/security.xml 2010-05-14 07:31:51 UTC (rev 9232)
@@ -213,6 +213,18 @@
>org.hornetq.integration.jboss.security.JBossASSecurityManager</literal>。</para>
<para>要了解如何配置JBoss安全管理器,可以看一眼HornetQ发布包中相关例子中的
<literal>hornetq-jboss-beans.xml</literal>文件。</para>
+ <section>
+ <title>配置客户端登录</title>
+ <para>JBoss可以配置使用客户登录。JEE的模块如servlet或EJB可以将安全认证信息设置到安全上下文(security context)中,
+ 用于整个调用过程。如果想在HornetQ在发送和接收消息时使用这些认证(credential)信息,需要将参数
+ <literal>allowClientLogin</literal>设为true。它会越过HornetQ的身份验证过程并会传播安全上下文(security
+ context)。如果你想要HornetQ使用传播的安全信息进行身份验证,需要同时将参数<literal>authoriseOnClientLogin</literal>
+ 设为true。</para>
+ <para>关于客户端登录的详细信息请访问<ulink
+ url="http://community.jboss.org/wiki/ClientLoginModule">这里</ulink>。 </para>
+ <note><para>如果消息是以非阻塞方式发送的,那么有可能在消息到达服务器时,调用线程已经结束,安全上下文也被清除了。
+ 所以如果使用安全上下文,需要采用阻塞方式发送消息。</para></note>
+ </section>
</section>
<section>
<title>集群用户名/密码的配置</title>
14 years, 10 months
JBoss hornetq SVN: r9231 - trunk.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-05-13 20:11:11 -0400 (Thu, 13 May 2010)
New Revision: 9231
Modified:
trunk/pom.xml
Log:
Upgrading Netty to 3.2.0.CR1
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-05-12 09:23:05 UTC (rev 9230)
+++ trunk/pom.xml 2010-05-14 00:11:11 UTC (rev 9231)
@@ -222,7 +222,7 @@
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
- <version>3.2.0.BETA1</version>
+ <version>3.2.0.CR1</version>
</dependency>
<!--needed to compile the logging jar-->
<dependency>
14 years, 10 months
JBoss hornetq SVN: r9230 - in trunk: examples/jms/stomp-websockets and 1 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-05-12 05:23:05 -0400 (Wed, 12 May 2010)
New Revision: 9230
Modified:
trunk/build-maven.xml
trunk/examples/jms/stomp-websockets/readme.html
trunk/src/config/common/hornetq-version.properties
Log:
updated version numbers for upcoming release
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2010-05-12 07:52:19 UTC (rev 9229)
+++ trunk/build-maven.xml 2010-05-12 09:23:05 UTC (rev 9230)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.1.0.BETA3"/>
+ <property name="hornetq.version" value="2.1.0.CR1"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
Modified: trunk/examples/jms/stomp-websockets/readme.html
===================================================================
--- trunk/examples/jms/stomp-websockets/readme.html 2010-05-12 07:52:19 UTC (rev 9229)
+++ trunk/examples/jms/stomp-websockets/readme.html 2010-05-12 09:23:05 UTC (rev 9230)
@@ -49,7 +49,7 @@
$ ./run.sh ../examples/jms/stomp-websockets/server0
...
[main] 17:45:03,498 INFO [org.hornetq.core.remoting.impl.netty.NettyAcceptor] Started Netty Acceptor version 3.2.0.BETA1-r2215 localhost:61614 for STOMP_WS protocol
-[main] 17:45:03,505 INFO [org.hornetq.core.server.impl.HornetQServerImpl] HornetQ Server version 2.1.0.BETA3 (Hungry Hornet, 117) started
+[main] 17:45:03,505 INFO [org.hornetq.core.server.impl.HornetQServerImpl] HornetQ Server version 2.1.0.CR1 (Hungry Hornet, 117) started
</pre>
<p>To publish a message to a JMS topic from a Java application, simply type <code>./build.sh</code>
Modified: trunk/src/config/common/hornetq-version.properties
===================================================================
--- trunk/src/config/common/hornetq-version.properties 2010-05-12 07:52:19 UTC (rev 9229)
+++ trunk/src/config/common/hornetq-version.properties 2010-05-12 09:23:05 UTC (rev 9230)
@@ -1,8 +1,8 @@
-hornetq.version.versionName=Hungry Hornet
+hornetq.version.versionName=auraria
hornetq.version.majorVersion=2
hornetq.version.minorVersion=1
hornetq.version.microVersion=0
-hornetq.version.incrementingVersion=117
-hornetq.version.versionSuffix=BETA3
-hornetq.version.versionTag=BETA3
+hornetq.version.incrementingVersion=118
+hornetq.version.versionSuffix=CR1
+hornetq.version.versionTag=CR1
hornetq.netty.version=(a)NETTY.VERSION@
14 years, 10 months
JBoss hornetq SVN: r9229 - trunk/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-05-12 03:52:19 -0400 (Wed, 12 May 2010)
New Revision: 9229
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-385
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-05-11 23:40:00 UTC (rev 9228)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-05-12 07:52:19 UTC (rev 9229)
@@ -73,7 +73,7 @@
// https://jira.jboss.org/jira/browse/HORNETQ-385
- public void disabled_testNoCacheWithReceiveImmediate() throws Exception
+ public void disabled_testReceiveImmediateWithZeroWindow() throws Exception
{
HornetQServer server = createServer(false, isNetty());
try
@@ -137,7 +137,7 @@
}
// https://jira.jboss.org/jira/browse/HORNETQ-385
- public void disabled_testNoCacheWithReceiveImmediate2() throws Exception
+ public void disabled_testReceiveImmediateWithZeroWindow2() throws Exception
{
HornetQServer server = createServer(true);
@@ -190,7 +190,134 @@
}
}
+ // https://jira.jboss.org/jira/browse/HORNETQ-385
+ public void disabled_testReceiveImmediateWithZeroWindow3() throws Exception
+ {
+ HornetQServer server = createServer(false, isNetty());
+ try
+ {
+ server.start();
+
+ ClientSessionFactory sf = createFactory(isNetty());
+
+ sf.setConsumerWindowSize(0);
+
+ ClientSession session = sf.createSession(false, false, false);
+ session.createQueue("testWindow", "testWindow", true);
+ session.close();
+
+ int numConsumers = 5;
+
+ ArrayList<ClientConsumer> consumers = new ArrayList<ClientConsumer>();
+ ArrayList<ClientSession> sessions = new ArrayList<ClientSession>();
+ for (int i = 0; i < numConsumers; i++)
+ {
+ System.out.println("created: " + i);
+ ClientSession session1 = sf.createSession();
+ ClientConsumer consumer = session1.createConsumer("testWindow");
+ consumers.add(consumer);
+ session1.start();
+ sessions.add(session1);
+ consumer.receive(10);
+
+ }
+
+ ClientSession senderSession = sf.createSession(false, false);
+
+ ClientProducer producer = senderSession.createProducer("testWindow");
+
+ ClientMessage sent = senderSession.createMessage(true);
+ sent.putStringProperty("hello", "world");
+
+ producer.send(sent);
+
+ senderSession.commit();
+
+ senderSession.start();
+
+ ClientConsumer consumer = consumers.get(2);
+ ClientMessage received = consumer.receive(1000);
+ assertNotNull(received);
+
+ for (ClientSession tmpSess : sessions)
+ {
+ tmpSess.close();
+ }
+
+ senderSession.close();
+
+ }
+ finally
+ {
+ server.stop();
+ }
+
+ }
+ public void disabled_testReceiveImmediateWithZeroWindow4() throws Exception
+ {
+ HornetQServer server = createServer(false, isNetty());
+ try
+ {
+ server.start();
+
+ ClientSessionFactory sf = createFactory(isNetty());
+
+ sf.setConsumerWindowSize(0);
+
+ ClientSession session = sf.createSession(false, false, false);
+ session.createQueue("testWindow", "testWindow", true);
+ session.close();
+
+ int numConsumers = 5;
+
+ ArrayList<ClientConsumer> consumers = new ArrayList<ClientConsumer>();
+ ArrayList<ClientSession> sessions = new ArrayList<ClientSession>();
+ for (int i = 0; i < numConsumers; i++)
+ {
+ System.out.println("created: " + i);
+ ClientSession session1 = sf.createSession();
+ ClientConsumer consumer = session1.createConsumer("testWindow");
+ consumers.add(consumer);
+ session1.start();
+ sessions.add(session1);
+ consumer.receive(10);
+
+ }
+
+ ClientSession senderSession = sf.createSession(false, false);
+
+ ClientProducer producer = senderSession.createProducer("testWindow");
+
+ ClientMessage sent = senderSession.createMessage(true);
+ sent.putStringProperty("hello", "world");
+
+ producer.send(sent);
+
+ senderSession.commit();
+
+ senderSession.start();
+
+ ClientConsumer consumer = consumers.get(2);
+ ClientMessage received = consumer.receiveImmediate();
+ assertNotNull(received);
+
+ for (ClientSession tmpSess : sessions)
+ {
+ tmpSess.close();
+ }
+
+ senderSession.close();
+
+ }
+ finally
+ {
+ server.stop();
+ }
+
+ }
+
+
/*
* tests send window size. we do this by having 2 receivers on the q. since we roundrobin the consumer for delivery we
* know if consumer 1 has received n messages then consumer 2 must have also have received n messages or at least up
14 years, 10 months
JBoss hornetq SVN: r9228 - trunk/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-05-11 19:40:00 -0400 (Tue, 11 May 2010)
New Revision: 9228
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-385 - Adding Bill Burke's test (in disabled form ATM)
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-05-11 19:40:06 UTC (rev 9227)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-05-11 23:40:00 UTC (rev 9228)
@@ -12,12 +12,14 @@
*/
package org.hornetq.tests.integration.client;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
@@ -69,6 +71,126 @@
return encodeSize;
}
+
+ // https://jira.jboss.org/jira/browse/HORNETQ-385
+ public void disabled_testNoCacheWithReceiveImmediate() throws Exception
+ {
+ HornetQServer server = createServer(false, isNetty());
+ try
+ {
+ server.start();
+
+ ClientSessionFactory sf = createFactory(isNetty());
+
+ sf.setConsumerWindowSize(0);
+
+ ClientSession session = sf.createSession(false, false, false);
+ session.createQueue("testWindow", "testWindow", true);
+ session.close();
+
+ int numConsumers = 5;
+
+ ArrayList<ClientConsumer> consumers = new ArrayList<ClientConsumer>();
+ ArrayList<ClientSession> sessions = new ArrayList<ClientSession>();
+ for (int i = 0; i < numConsumers; i++)
+ {
+ System.out.println("created: " + i);
+ ClientSession session1 = sf.createSession();
+ ClientConsumer consumer = session1.createConsumer("testWindow");
+ consumers.add(consumer);
+ session1.start();
+ sessions.add(session1);
+ consumer.receiveImmediate();
+
+ }
+
+ ClientSession senderSession = sf.createSession(false, false);
+
+ ClientProducer producer = senderSession.createProducer("testWindow");
+
+ ClientMessage sent = senderSession.createMessage(true);
+ sent.putStringProperty("hello", "world");
+
+ producer.send(sent);
+
+ senderSession.commit();
+
+ senderSession.start();
+
+ ClientConsumer consumer = consumers.get(2);
+ ClientMessage received = consumer.receive(1000);
+ assertNotNull(received);
+
+ for (ClientSession tmpSess : sessions)
+ {
+ tmpSess.close();
+ }
+
+ senderSession.close();
+
+ }
+ finally
+ {
+ server.stop();
+ }
+
+ }
+
+ // https://jira.jboss.org/jira/browse/HORNETQ-385
+ public void disabled_testNoCacheWithReceiveImmediate2() throws Exception
+ {
+ HornetQServer server = createServer(true);
+
+ try
+ {
+ server.start();
+
+ ClientSessionFactory sf = createFactory(false);
+ sf.setConsumerWindowSize(0);
+
+ ClientSession session = sf.createSession(false, false, false);
+ session.createQueue("testReceive", "testReceive", true);
+ session.close();
+
+ ClientSession sessionProd = sf.createSession(false, false);
+ ClientMessage msg = sessionProd.createMessage(true);
+ msg.putStringProperty("hello", "world");
+ ClientProducer prod = sessionProd.createProducer("testReceive");
+
+ prod.send(msg);
+ sessionProd.commit();
+
+ ClientSession session1 = sf.createSession();
+ ClientConsumer consumer = session1.createConsumer("testReceive");
+ session1.start();
+
+ Thread.sleep(1000);
+ ClientMessage message = null;
+ message = consumer.receiveImmediate();
+ //message = consumer.receive(1000); // the test will pass if used receive(1000) instead of receiveImmediate
+ assertNotNull(message);
+ System.out.println(message.getStringProperty("hello"));
+ message.acknowledge();
+
+ prod.send(msg);
+ sessionProd.commit();
+
+ message = consumer.receive(1000);
+ assertNotNull(message);
+ System.out.println(message.getStringProperty("hello"));
+ message.acknowledge();
+
+ session.close();
+ session1.close();
+ sessionProd.close();
+ }
+ finally
+ {
+ server.stop();
+ }
+ }
+
+
/*
* tests send window size. we do this by having 2 receivers on the q. since we roundrobin the consumer for delivery we
* know if consumer 1 has received n messages then consumer 2 must have also have received n messages or at least up
14 years, 10 months
JBoss hornetq SVN: r9227 - trunk/examples/common.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-05-11 15:40:06 -0400 (Tue, 11 May 2010)
New Revision: 9227
Modified:
trunk/examples/common/build.xml
Log:
excluding websocket example from all target
Modified: trunk/examples/common/build.xml
===================================================================
--- trunk/examples/common/build.xml 2010-05-11 18:52:24 UTC (rev 9226)
+++ trunk/examples/common/build.xml 2010-05-11 19:40:06 UTC (rev 9227)
@@ -201,6 +201,7 @@
<exclude name="jms/jms-bridge/build.xml"/>
<exclude name="jms/large-message/build.xml"/>
<exclude name="jms/perf/build.xml"/>
+ <exclude name="jms/stomp-websockets/build.xml"/>
</fileset>
</subant>
14 years, 10 months
JBoss hornetq SVN: r9226 - in trunk/examples/jms: queue-requestor/server0 and 2 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-05-11 14:52:24 -0400 (Tue, 11 May 2010)
New Revision: 9226
Modified:
trunk/examples/jms/management/server0/hornetq-configuration.xml
trunk/examples/jms/queue-requestor/server0/hornetq-configuration.xml
trunk/examples/jms/request-reply/server0/hornetq-configuration.xml
trunk/examples/jms/temp-queue/server0/hornetq-configuration.xml
Log:
fixed examples security for temp queues
Modified: trunk/examples/jms/management/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/management/server0/hornetq-configuration.xml 2010-05-11 11:08:05 UTC (rev 9225)
+++ trunk/examples/jms/management/server0/hornetq-configuration.xml 2010-05-11 18:52:24 UTC (rev 9226)
@@ -35,7 +35,7 @@
</security-setting>
<!-- security settings for JMS temporary queue -->
- <security-setting match="jms.queue.#">
+ <security-setting match="jms.tempqueue.#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
Modified: trunk/examples/jms/queue-requestor/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/queue-requestor/server0/hornetq-configuration.xml 2010-05-11 11:08:05 UTC (rev 9225)
+++ trunk/examples/jms/queue-requestor/server0/hornetq-configuration.xml 2010-05-11 18:52:24 UTC (rev 9226)
@@ -29,6 +29,13 @@
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
+ <!-- security settings for JMS temporary queue -->
+ <security-setting match="jms.tempqueue.#">
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
</security-settings>
</configuration>
Modified: trunk/examples/jms/request-reply/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/request-reply/server0/hornetq-configuration.xml 2010-05-11 11:08:05 UTC (rev 9225)
+++ trunk/examples/jms/request-reply/server0/hornetq-configuration.xml 2010-05-11 18:52:24 UTC (rev 9226)
@@ -28,6 +28,13 @@
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
+ <!-- security settings for JMS temporary queue -->
+ <security-setting match="jms.tempqueue.#">
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
</security-settings>
</configuration>
Modified: trunk/examples/jms/temp-queue/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/temp-queue/server0/hornetq-configuration.xml 2010-05-11 11:08:05 UTC (rev 9225)
+++ trunk/examples/jms/temp-queue/server0/hornetq-configuration.xml 2010-05-11 18:52:24 UTC (rev 9226)
@@ -29,6 +29,13 @@
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
+ <!-- security settings for JMS temporary queue -->
+ <security-setting match="jms.tempqueue.#">
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
</security-settings>
</configuration>
14 years, 10 months
JBoss hornetq SVN: r9225 - in trunk: src/config/jboss-as-5/clustered and 4 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-05-11 07:08:05 -0400 (Tue, 11 May 2010)
New Revision: 9225
Modified:
trunk/docs/user-manual/en/security.xml
trunk/src/config/jboss-as-5/clustered/hornetq-jboss-beans.xml
trunk/src/config/jboss-as-5/non-clustered/hornetq-jboss-beans.xml
trunk/src/config/jboss-as-6/clustered/hornetq-jboss-beans.xml
trunk/src/config/jboss-as-6/non-clustered/hornetq-jboss-beans.xml
trunk/src/main/org/hornetq/integration/jboss/security/JBossASSecurityManager.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-340 - fixed jboss security manager to allow client login propogation
Modified: trunk/docs/user-manual/en/security.xml
===================================================================
--- trunk/docs/user-manual/en/security.xml 2010-05-11 00:51:32 UTC (rev 9224)
+++ trunk/docs/user-manual/en/security.xml 2010-05-11 11:08:05 UTC (rev 9225)
@@ -261,6 +261,20 @@
<para>Take a look at one of the default <literal>hornetq-jboss-beans.xml</literal> files for
JBoss Application Server that are bundled in the distribution for an example of how this
is configured.</para>
+ <section>
+ <title>Configuring Client Login</title>
+ <para>JBoss can be configured to allow client login, basically this is when a JEE component such as a Servlet
+ or EJB sets security credentials on the current security context and these are used throughout the call.
+ If you would like these credentials to be used by HornetQ when sending or consuming messages then
+ set <literal>allowClientLogin</literal> to true. This will bypass HornetQ authentication and propgate the
+ provided Security Context. If you woul like HornetQ to authenticate using the propogated security then set the
+ <literal>authoriseOnClientLogin</literal> to true also.</para>
+ <para>There is more info on using the JBoss client login module <ulink
+ url="http://community.jboss.org/wiki/ClientLoginModule">here</ulink> </para>
+ <note><para>If messages are sent non blocking then there is a chance that these could arrive on the server after
+ the calling thread has completed meaning that the security context has been cleared. If this is the case then messages
+ will need to be sent blocking</para></note>
+ </section>
</section>
<section>
<title>Changing the username/password for clustering</title>
Modified: trunk/src/config/jboss-as-5/clustered/hornetq-jboss-beans.xml
===================================================================
--- trunk/src/config/jboss-as-5/clustered/hornetq-jboss-beans.xml 2010-05-11 00:51:32 UTC (rev 9224)
+++ trunk/src/config/jboss-as-5/clustered/hornetq-jboss-beans.xml 2010-05-11 11:08:05 UTC (rev 9225)
@@ -16,6 +16,8 @@
<depends>JBossSecurityJNDIContextEstablishment</depends>
<start ignored="true"/>
<stop ignored="true"/>
+ <property name="allowClientLogin">false</property>
+ <property name="authoriseOnClientLogin">false</property>
</bean>
<!-- The core server -->
Modified: trunk/src/config/jboss-as-5/non-clustered/hornetq-jboss-beans.xml
===================================================================
--- trunk/src/config/jboss-as-5/non-clustered/hornetq-jboss-beans.xml 2010-05-11 00:51:32 UTC (rev 9224)
+++ trunk/src/config/jboss-as-5/non-clustered/hornetq-jboss-beans.xml 2010-05-11 11:08:05 UTC (rev 9225)
@@ -16,6 +16,8 @@
<depends>JBossSecurityJNDIContextEstablishment</depends>
<start ignored="true"/>
<stop ignored="true"/>
+ <property name="allowClientLogin">false</property>
+ <property name="authoriseOnClientLogin">false</property>
</bean>
<!-- The core server -->
Modified: trunk/src/config/jboss-as-6/clustered/hornetq-jboss-beans.xml
===================================================================
--- trunk/src/config/jboss-as-6/clustered/hornetq-jboss-beans.xml 2010-05-11 00:51:32 UTC (rev 9224)
+++ trunk/src/config/jboss-as-6/clustered/hornetq-jboss-beans.xml 2010-05-11 11:08:05 UTC (rev 9225)
@@ -18,6 +18,8 @@
<start ignored="true"/>
<stop ignored="true"/>
<depends>JBossSecurityJNDIContextEstablishment</depends>
+ <property name="allowClientLogin">false</property>
+ <property name="authoriseOnClientLogin">false</property>
</bean>
<!-- The core server -->
Modified: trunk/src/config/jboss-as-6/non-clustered/hornetq-jboss-beans.xml
===================================================================
--- trunk/src/config/jboss-as-6/non-clustered/hornetq-jboss-beans.xml 2010-05-11 00:51:32 UTC (rev 9224)
+++ trunk/src/config/jboss-as-6/non-clustered/hornetq-jboss-beans.xml 2010-05-11 11:08:05 UTC (rev 9225)
@@ -18,6 +18,8 @@
<start ignored="true"/>
<stop ignored="true"/>
<depends>JBossSecurityJNDIContextEstablishment</depends>
+ <property name="allowClientLogin">false</property>
+ <property name="authoriseOnClientLogin">false</property>
</bean>
<!-- The core server -->
Modified: trunk/src/main/org/hornetq/integration/jboss/security/JBossASSecurityManager.java
===================================================================
--- trunk/src/main/org/hornetq/integration/jboss/security/JBossASSecurityManager.java 2010-05-11 00:51:32 UTC (rev 9224)
+++ trunk/src/main/org/hornetq/integration/jboss/security/JBossASSecurityManager.java 2010-05-11 11:08:05 UTC (rev 9225)
@@ -25,9 +25,7 @@
import org.hornetq.core.security.Role;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.spi.core.security.HornetQSecurityManager;
-import org.jboss.security.AuthenticationManager;
-import org.jboss.security.RealmMapping;
-import org.jboss.security.SimplePrincipal;
+import org.jboss.security.*;
/**
* This implementation delegates to the JBoss AS security interfaces (which in turn use JAAS)
@@ -65,6 +63,10 @@
private boolean isAs5 = true;
+ private boolean allowClientLogin = false;
+
+ private boolean authoriseOnClientLogin = false;
+
public boolean validateUser(final String user, final String password)
{
SimplePrincipal principal = new SimplePrincipal(user);
@@ -86,6 +88,18 @@
final Set<Role> roles,
final CheckType checkType)
{
+ if(allowClientLogin && SecurityContextAssociation.isClient())
+ {
+ return authoriseOnClientLogin? useClientAuthentication(roles, checkType):true;
+ }
+ else
+ {
+ return useConnectionAuthentication(user, password, roles, checkType);
+ }
+ }
+
+ private boolean useConnectionAuthentication(final String user, final String password, final Set<Role> roles, final CheckType checkType)
+ {
SimplePrincipal principal = user == null ? null : new SimplePrincipal(user);
char[] passwordChars = null;
@@ -118,6 +132,31 @@
return authenticated;
}
+ private boolean useClientAuthentication(final Set<Role> roles, final CheckType checkType)
+ {
+ SecurityContext sc = SecurityContextAssociation.getSecurityContext();
+ Principal principal = sc.getUtil().getUserPrincipal();
+
+ char[] passwordChars = (char[]) sc.getUtil().getCredential();
+
+ Subject subject = sc.getSubjectInfo().getAuthenticatedSubject();
+
+ boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
+
+ if (authenticated)
+ {
+ Set<Principal> rolePrincipals = getRolePrincipals(checkType, roles);
+
+ authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals);
+
+ if (trace)
+ {
+ JBossASSecurityManager.log.trace("user " + principal.getName() + (authenticated ? " is " : " is NOT ") + "authorized");
+ }
+ }
+ return authenticated;
+ }
+
private void popSecurityContext()
{
if (isAs5)
@@ -232,4 +271,14 @@
{
isAs5 = as5;
}
+
+ public void setAllowClientLogin(final boolean allowClientLogin)
+ {
+ this.allowClientLogin = allowClientLogin;
+ }
+
+ public void setAuthoriseOnClientLogin(final boolean authoriseOnClientLogin)
+ {
+ this.authoriseOnClientLogin = authoriseOnClientLogin;
+ }
}
14 years, 10 months