mirror of https://github.com/apache/activemq.git
Apply patch for https://issues.apache.org/activemq/browse/AMQ-1747
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@660517 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f9e67f2b7
commit
041b1b8ad5
|
@ -51,6 +51,12 @@ public class AuthorizationBroker extends BrokerFilter implements SecurityAdminMB
|
||||||
if (securityContext == null) {
|
if (securityContext == null) {
|
||||||
throw new SecurityException("User is not authenticated.");
|
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(!((ActiveMQTempDestination)destination).getConnectionId().equals(context.getConnectionId().getValue())
|
||||||
// ) {
|
// ) {
|
||||||
if (!securityContext.isBrokerContext()) {
|
if (!securityContext.isBrokerContext()) {
|
||||||
|
|
|
@ -18,9 +18,16 @@ package org.apache.activemq.security;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.jms.JMSException;
|
||||||
|
import javax.jms.Message;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
|
import org.apache.activemq.CombinationTestSupport;
|
||||||
import org.apache.activemq.broker.BrokerFactory;
|
import org.apache.activemq.broker.BrokerFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
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.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
@ -45,4 +52,19 @@ public class SimpleAuthenticationPluginTest extends SecurityTestSupport {
|
||||||
return BrokerFactory.createBroker(new URI("xbean:" + 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"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
|
|
||||||
<broker useJmx="false" persistent="false" xmlns="http://activemq.apache.org/schema/core" populateJMSXUserID="true">
|
<broker useJmx="false" persistent="false" xmlns="http://activemq.apache.org/schema/core" populateJMSXUserID="true">
|
||||||
|
|
||||||
|
<destinations>
|
||||||
|
<queue physicalName="TEST.Q" />
|
||||||
|
</destinations>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<simpleAuthenticationPlugin>
|
<simpleAuthenticationPlugin>
|
||||||
<users>
|
<users>
|
||||||
|
@ -44,6 +48,8 @@
|
||||||
<authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
|
<authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
|
||||||
<authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,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=">" read="admins" write="admins" admin="admins" />
|
||||||
<authorizationEntry topic="USERS.>" read="users" write="users" admin="users" />
|
<authorizationEntry topic="USERS.>" read="users" write="users" admin="users" />
|
||||||
<authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
|
<authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
|
||||||
|
|
Loading…
Reference in New Issue