ARTEMIS-3106 - apply mvn verify template to the example
This commit is contained in:
parent
9c9f89f1d5
commit
a195790005
|
@ -33,11 +33,84 @@ under the License.
|
|||
</properties>
|
||||
|
||||
<artifactId>sasl-scram</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<name>ActiveMQ Artemis SASL-SCRAM Example</name>
|
||||
|
||||
<modules>
|
||||
<module>sasl-client</module>
|
||||
<module>sasl-server</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.qpid</groupId>
|
||||
<artifactId>qpid-jms-client</artifactId>
|
||||
<version>${qpid.jms.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create</id>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<ignore>${noServer}</ignore>
|
||||
<instance>${basedir}/target/server0</instance>
|
||||
<configuration>${basedir}/target/classes/activemq/server0</configuration>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>start</id>
|
||||
<goals>
|
||||
<goal>cli</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<spawn>true</spawn>
|
||||
<ignore>${noServer}</ignore>
|
||||
<testURI>tcp://localhost:61616</testURI>
|
||||
<testUser>hello</testUser>
|
||||
<testPassword>ogre1234</testPassword>
|
||||
<args>
|
||||
<param>run</param>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>runClient</id>
|
||||
<goals>
|
||||
<goal>runClient</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.QPIDClient</clientClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop</id>
|
||||
<goals>
|
||||
<goal>cli</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<ignore>${noServer}</ignore>
|
||||
<args>
|
||||
<param>stop</param>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.amqp</groupId>
|
||||
<artifactId>sasl-scram</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
# Artemis SASL-SCRAM Server and Client Example
|
||||
|
||||
Demonstrates the usage of SASL-SCRAM authentication with ActiveMQ Artemis
|
||||
|
||||
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify**
|
||||
if you want to start and create the broker manually.
|
||||
|
||||
Of note is the AMQP acceptor configuration restricting the offered mechanisms to SCRAM-SHA-256, and the reference
|
||||
to the login config scope ``amqp-sasl-scram`` that holds the relevant SCRAM login module.
|
||||
|
||||
````
|
||||
<acceptor name="amqp">tcp://localhost:5672?protocols=AMQP;saslMechanisms=SCRAM-SHA-256;saslLoginConfigScope=amqp-sasl-scram
|
||||
````
|
||||
|
||||
Also note, the password supplied to the QPID JMS AMQP client is not stored in the users.properties on the broker. It does not
|
||||
leave the client!.
|
||||
The secure encoded form of the password has been generated/registered using:
|
||||
|
||||
````
|
||||
java org.apache.activemq.artemis.spi.core.security.jaas.SCRAMPropertiesLoginModule <username> <password> [<iterations>]
|
||||
````
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.activemq.examples.amqp</groupId>
|
||||
<artifactId>sasl-scram</artifactId>
|
||||
<version>2.18.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sasl-scram-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>ActiveMQ Artemis SASL-SCRAM-Client Example</name>
|
||||
|
||||
<properties>
|
||||
<activemq.basedir>${project.basedir}/../../../../..</activemq.basedir>
|
||||
<artemis-version>${project.version}</artemis-version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.qpid</groupId>
|
||||
<artifactId>qpid-jms-client</artifactId>
|
||||
<version>${qpid.jms.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,3 +0,0 @@
|
|||
# Artemis SASL-SCRAM Server and Client Example
|
||||
|
||||
demonstrate the usage of SASL-SCRAM authentication with ActiveMQ Artemis
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.activemq.examples.amqp</groupId>
|
||||
<artifactId>sasl-scram</artifactId>
|
||||
<version>2.18.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sasl-scram-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>ActiveMQ Artemis SASL-SCRAM-Server Example</name>
|
||||
|
||||
<properties>
|
||||
<activemq.basedir>${project.basedir}/../../../../..</activemq.basedir>
|
||||
<artemis-version>${project.version}</artemis-version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-server</artifactId>
|
||||
<version>${artemis-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-amqp-protocol</artifactId>
|
||||
<version>${artemis-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,3 +0,0 @@
|
|||
# Artemis SASL-SCRAM Server and Client Example
|
||||
|
||||
demonstrate the usage of SASL-SCRAM authentication with ActiveMQ Artemis
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* <p>
|
||||
* All rights reserved. Licensed 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.activemq.artemis.jms.example;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
|
||||
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
|
||||
|
||||
public class TestServer {
|
||||
public static void main(String[] args) throws Exception {
|
||||
File configFolder = new File(args.length > 0 ? args[0] : "src/main/resources/").getAbsoluteFile();
|
||||
System.setProperty("java.security.auth.login.config", new File(configFolder, "login.conf").getAbsolutePath());
|
||||
EmbeddedActiveMQ embedded = new EmbeddedActiveMQ();
|
||||
embedded.setSecurityManager(new ActiveMQJAASSecurityManager("artemis"));
|
||||
embedded.setConfigResourcePath(new File(configFolder, "broker.xml").getAbsoluteFile().toURI().toASCIIString());
|
||||
embedded.start();
|
||||
while (true) {
|
||||
// intentional empty
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -27,7 +27,6 @@ import org.apache.qpid.jms.JmsConnectionFactory;
|
|||
|
||||
public class QPIDClient {
|
||||
public static void main(String[] args) throws JMSException {
|
||||
sendReceive("SCRAM-SHA-1", "hello", "ogre1234");
|
||||
sendReceive("SCRAM-SHA-256", "test", "test");
|
||||
}
|
||||
|
|
@ -19,6 +19,5 @@
|
|||
# Example for an encoded username/password, encoded forms can be generated with java org.apache.activemq.artemis.spi.core.security.jaas.SCRAMPropertiesLoginModule <username> <password> [<iterations>]
|
||||
test|SHA512 = ENC(7TilOEFipzE4KNkDUTlfnuMkYE1yveyXmK6iBx8/fnE=:4096:yPl/n8eZQEyVmkhuYvrgZCchEpO+a9QiGLXwJfqBWOIfTxMX5TkoHp5eYGABc68cUvoynqCnoqRLDPac+H1urg==:eX5X39hbChbXz00TCkMpmsHqsJTiMGCwamty6yjUS0M+HoE/SLtd2MYY1Shyn+5mu30qFsbXz0WlRA+dZ3Lv3A==)
|
||||
test|SHA256 = ENC(yNekJSAvbunYIIHKni32oXgg7uCSUZSzvgNq3pLL3so=:4096:45p4iB+tgMB2b2FM6MmuzyTF63QOfQroQLwNXxhCZ48=:PXUabvM/90DWQsl/p9Cp7wYlavCTPJZnzdU9PFUuiXc=)
|
||||
test|SHA1 = ENC(ehArM+Qzko2eua0hMq0o+NQ9BaTTf4q8xY0tzfy2Zvw=:4096:LvpLr4ezL4ICxeiXAkXEVH9EhO0=:gLELi8NpLVorxXbPIIbVZF/oqh8=)
|
||||
# Example for a plain username/password, don't use this on public servers!
|
||||
hello = ogre1234
|
|
@ -28,8 +28,12 @@ under the License.
|
|||
<security-enabled>true</security-enabled>
|
||||
|
||||
<acceptors>
|
||||
<acceptor name="amqp">tcp://localhost:5672?protocols=AMQP;saslMechanisms=SCRAM-SHA-256,SCRAM-SHA-1;saslLoginConfigScope=amqp-sasl-scram
|
||||
<acceptor name="amqp">tcp://localhost:5672?protocols=AMQP;saslMechanisms=SCRAM-SHA-256;saslLoginConfigScope=amqp-sasl-scram
|
||||
</acceptor>
|
||||
|
||||
<acceptor name="core-for-async-start-check">tcp://localhost:61616?protocols=CORE
|
||||
</acceptor>
|
||||
|
||||
</acceptors>
|
||||
<security-settings>
|
||||
<security-setting match="#">
|
|
@ -23,7 +23,13 @@ amqp-sasl-scram {
|
|||
};
|
||||
|
||||
|
||||
artemis {
|
||||
org.apache.activemq.artemis.spi.core.security.jaas.SCRAMLoginModule required
|
||||
activemq {
|
||||
org.apache.activemq.artemis.spi.core.security.jaas.SCRAMLoginModule sufficient
|
||||
;
|
||||
|
||||
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient
|
||||
org.apache.activemq.jaas.properties.user="artemis-users.properties"
|
||||
org.apache.activemq.jaas.properties.role="artemis-roles.properties"
|
||||
;
|
||||
|
||||
};
|
Loading…
Reference in New Issue