mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@732672 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2387612628
commit
e3eba85450
|
@ -29,7 +29,14 @@ import javax.net.ssl.SSLSocketFactory;
|
|||
public class StompSslTest extends StompTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
bindAddress = "stomp+ssl://localhost:0";
|
||||
bindAddress = "stomp+ssl://localhost:61612";
|
||||
confUri = "xbean:org/apache/activemq/transport/stomp/sslstomp-auth-broker.xml";
|
||||
System.setProperty("javax.net.ssl.trustStore", "src/test/resources/client.keystore");
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", "password");
|
||||
System.setProperty("javax.net.ssl.trustStoreType", "jks");
|
||||
System.setProperty("javax.net.ssl.keyStore", "src/test/resources/server.keystore");
|
||||
System.setProperty("javax.net.ssl.keyStorePassword", "password");
|
||||
System.setProperty("javax.net.ssl.keyStoreType", "jks");
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.Message;
|
||||
|
@ -27,6 +28,7 @@ import javax.jms.MessageProducer;
|
|||
import javax.jms.Session;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
|
@ -66,7 +68,7 @@ public class StompSubscriptionRemoveTest extends TestCase {
|
|||
session.close();
|
||||
connection.close();
|
||||
|
||||
stompConnection.open("localhost", STOMP_PORT);
|
||||
stompConnection.open(new Socket("localhost", STOMP_PORT));
|
||||
|
||||
String connectFrame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n";
|
||||
stompConnection.sendFrame(connectFrame);
|
||||
|
@ -93,7 +95,7 @@ public class StompSubscriptionRemoveTest extends TestCase {
|
|||
Thread.sleep(1000);
|
||||
stompConnection.close();
|
||||
|
||||
stompConnection.open("localhost", STOMP_PORT);
|
||||
stompConnection.open(new Socket("localhost", STOMP_PORT));
|
||||
|
||||
connectFrame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n";
|
||||
stompConnection.sendFrame(connectFrame);
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- this file can only be parsed using the xbean-spring library -->
|
||||
<!-- START SNIPPET: example -->
|
||||
<beans>
|
||||
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
|
||||
|
||||
<bean class="org.apache.activemq.util.XStreamFactoryBean" name="xstream">
|
||||
<property name="annotatedClass"><value>org.apache.activemq.transport.stomp.SamplePojo</value></property>
|
||||
</bean>
|
||||
|
||||
<broker useJmx="true" persistent="false" xmlns="http://activemq.org/config/1.0" populateJMSXUserID="true">
|
||||
|
||||
<transportConnectors>
|
||||
<transportConnector name="stomp+ssl" uri="stomp+ssl://localhost:61612"/>
|
||||
</transportConnectors>
|
||||
|
||||
<plugins>
|
||||
<simpleAuthenticationPlugin>
|
||||
<users>
|
||||
<authenticationUser username="system" password="manager"
|
||||
groups="users,admins"/>
|
||||
<authenticationUser username="user" password="password"
|
||||
groups="users"/>
|
||||
<authenticationUser username="guest" password="password" groups="guests"/>
|
||||
</users>
|
||||
</simpleAuthenticationPlugin>
|
||||
|
||||
|
||||
<!-- lets configure a destination based authorization mechanism -->
|
||||
<authorizationPlugin>
|
||||
<map>
|
||||
<authorizationMap>
|
||||
<authorizationEntries>
|
||||
<authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
|
||||
<authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
|
||||
<authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
|
||||
|
||||
<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" />
|
||||
|
||||
<authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/>
|
||||
</authorizationEntries>
|
||||
</authorizationMap>
|
||||
</map>
|
||||
</authorizationPlugin>
|
||||
</plugins>
|
||||
</broker>
|
||||
|
||||
</beans>
|
Loading…
Reference in New Issue