diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index a2d7e63f5d..1b4a175662 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -72,15 +72,11 @@ public class Create extends InputAbstract {
public static final String ETC_BOOTSTRAP_XML = "etc/bootstrap.xml";
public static final String ETC_BROKER_XML = "etc/broker.xml";
- // The JAAS PropertiesLogin module uses role=user(s) syntax, but the basic security uses user=role(s) syntax so we need 2 different files here
public static final String ETC_ARTEMIS_ROLES_PROPERTIES = "etc/artemis-roles.properties";
- public static final String ETC_ARTEMIS_ROLES_BASIC_PROPERTIES = "etc/artemis-roles-basic.properties";
- public static final String ETC_ARTEMIS_ROLES_JAAS_PROPERTIES = "etc/artemis-roles-jaas.properties";
-
public static final String ETC_ARTEMIS_USERS_PROPERTIES = "etc/artemis-users.properties";
- public static final String ETC_JAAS_BROKER_SECURITY_SETTINGS_TXT = "etc/jaas-broker-security-settings.txt";
- public static final String ETC_BASIC_BROKER_SECURITY_SETTINGS_TXT = "etc/basic-broker-security-settings.txt";
public static final String ETC_LOGIN_CONFIG = "etc/login.config";
+ public static final String ETC_LOGIN_CONFIG_WITH_GUEST = "etc/login-with-guest.config";
+ public static final String ETC_LOGIN_CONFIG_WITHOUT_GUEST = "etc/login-without-guest.config";
public static final String ETC_REPLICATED_SETTINGS_TXT = "etc/replicated-settings.txt";
public static final String ETC_SHARED_STORE_SETTINGS_TXT = "etc/shared-store-settings.txt";
public static final String ETC_CLUSTER_SECURITY_SETTINGS_TXT = "etc/cluster-security-settings.txt";
@@ -173,24 +169,10 @@ public class Create extends InputAbstract {
@Option(name = "--nio", description = "Force nio journal on the configuration regardless of the library being available or not.")
boolean forceNIO;
- @Option(name = "--broker-security", description = "Use basic, file-based security or JAAS login module for broker security (Default: basic)")
- String brokerSecurity;
-
boolean IS_WINDOWS;
boolean IS_CYGWIN;
- public String getBrokerSecurity() {
- if (brokerSecurity == null) {
- brokerSecurity = "basic";
- }
- return brokerSecurity;
- }
-
- public void setBrokerSecurity(String security) {
- this.brokerSecurity = security;
- }
-
public int getMaxHops() {
return maxHops;
}
@@ -561,27 +543,16 @@ public class Create extends InputAbstract {
filters.put("${java-opts}", javaOptions);
if (isAllowAnonymous()) {
- filters.put("${bootstrap.guest}", "default-user=\"" + getUser() + "\"");
+ write(ETC_LOGIN_CONFIG_WITH_GUEST, filters, false);
+ new File(directory, ETC_LOGIN_CONFIG_WITH_GUEST).renameTo(new File(directory, ETC_LOGIN_CONFIG));
}
else {
- filters.put("${bootstrap.guest}", "");
+ write(ETC_LOGIN_CONFIG_WITHOUT_GUEST, filters, false);
+ new File(directory, ETC_LOGIN_CONFIG_WITHOUT_GUEST).renameTo(new File(directory, ETC_LOGIN_CONFIG));
}
- if (brokerSecurity != null && brokerSecurity.equalsIgnoreCase("jaas")) {
- filters.put("${broker-security-settings}", applyFilters(readTextFile(ETC_JAAS_BROKER_SECURITY_SETTINGS_TXT), filters));
- filters.put("${login-config}", "-Djava.security.auth.login.config=" + path(directory, false) + "/etc/login.config");
- write(ETC_LOGIN_CONFIG, filters, false);
- write(ETC_ARTEMIS_ROLES_JAAS_PROPERTIES, filters, false);
- File file = new File(directory, ETC_ARTEMIS_ROLES_JAAS_PROPERTIES);
- file.renameTo(new File(directory, ETC_ARTEMIS_ROLES_PROPERTIES));
- }
- else {
- filters.put("${broker-security-settings}", applyFilters(readTextFile(ETC_BASIC_BROKER_SECURITY_SETTINGS_TXT), filters));
- filters.put("${login-config}", "");
- write(ETC_ARTEMIS_ROLES_BASIC_PROPERTIES, filters, false);
- File file = new File(directory, ETC_ARTEMIS_ROLES_BASIC_PROPERTIES);
- file.renameTo(new File(directory, ETC_ARTEMIS_ROLES_PROPERTIES));
- }
+ filters.put("${login-config}", "-Djava.security.auth.login.config=" + path(directory, false) + "/etc/login.config");
+ write(ETC_ARTEMIS_ROLES_PROPERTIES, filters, false);
if (IS_WINDOWS) {
write(BIN_ARTEMIS_CMD, null, false);
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/BasicSecurityHandler.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/BasicSecurityHandler.java
deleted file mode 100644
index b8eb2a57db..0000000000
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/BasicSecurityHandler.java
+++ /dev/null
@@ -1,45 +0,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.
- */
-package org.apache.activemq.artemis.factory;
-
-import java.io.File;
-
-import org.apache.activemq.artemis.core.config.impl.FileSecurityConfiguration;
-import org.apache.activemq.artemis.dto.BasicSecurityDTO;
-import org.apache.activemq.artemis.dto.SecurityDTO;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
-
-public class BasicSecurityHandler implements SecurityHandler {
-
- static String fixupFileURI(String value) {
- if (value != null && value.startsWith("file:")) {
- value = value.substring("file:".length());
- value = new File(value).toURI().toString();
- }
- return value;
- }
-
- @Override
- public ActiveMQSecurityManager createSecurityManager(SecurityDTO security) throws Exception {
- BasicSecurityDTO fileSecurity = (BasicSecurityDTO) security;
- String home = System.getProperty("activemq.home");
- FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration(fixupFileURI(fileSecurity.users), fixupFileURI(fileSecurity.roles), fileSecurity.defaultUser, fileSecurity.maskPassword, fileSecurity.passwordCodec);
- securityConfiguration.start();
- return new ActiveMQSecurityManagerImpl(securityConfiguration);
- }
-}
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/JaasSecurityHandler.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/JaasSecurityHandler.java
index 2cd1785e11..2f45f94b1c 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/JaasSecurityHandler.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/factory/JaasSecurityHandler.java
@@ -25,8 +25,7 @@ public class JaasSecurityHandler implements SecurityHandler {
@Override
public ActiveMQSecurityManager createSecurityManager(SecurityDTO security) throws Exception {
JaasSecurityDTO jaasSecurity = (JaasSecurityDTO) security;
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName(jaasSecurity.loginModule);
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(jaasSecurity.domain);
return securityManager;
}
}
diff --git a/artemis-cli/src/main/resources/META-INF/services/org/apache/activemq/artemis/broker/security/basic-security b/artemis-cli/src/main/resources/META-INF/services/org/apache/activemq/artemis/broker/security/basic-security
deleted file mode 100644
index 8418fe9639..0000000000
--- a/artemis-cli/src/main/resources/META-INF/services/org/apache/activemq/artemis/broker/security/basic-security
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-class=org.apache.activemq.artemis.factory.BasicSecurityHandler
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles-basic.properties b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles-basic.properties
deleted file mode 100644
index 04c3c4cbbc..0000000000
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles-basic.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-${user}=${role}
\ No newline at end of file
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles-jaas.properties b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles.properties
similarity index 100%
rename from artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles-jaas.properties
rename to artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles.properties
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/basic-broker-security-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/basic-broker-security-settings.txt
deleted file mode 100644
index dd0a5f121b..0000000000
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/basic-broker-security-settings.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
\ No newline at end of file
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml
index fe3f864191..ec4a489a4a 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml
@@ -18,7 +18,7 @@
-${broker-security-settings}
+
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jaas-broker-security-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jaas-broker-security-settings.txt
deleted file mode 100644
index 6521bf4b5f..0000000000
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jaas-broker-security-settings.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login-with-guest.config b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login-with-guest.config
new file mode 100644
index 0000000000..9f4dfea1e5
--- /dev/null
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login-with-guest.config
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+activemq {
+ org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient
+ debug=false
+ org.apache.activemq.jaas.properties.user="artemis-users.properties"
+ org.apache.activemq.jaas.properties.role="artemis-roles.properties";
+
+ org.apache.activemq.artemis.spi.core.security.jaas.GuestLoginModule sufficient
+ debug=false
+ org.apache.activemq.jaas.guest.user="${user}"
+ org.apache.activemq.jaas.guest.role="${role}";
+};
\ No newline at end of file
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login.config b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login-without-guest.config
similarity index 74%
rename from artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login.config
rename to artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login-without-guest.config
index fe8ca36878..89facb15de 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login.config
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/login-without-guest.config
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-PropertiesLogin {
- org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
- debug=true
- org.apache.activemq.jaas.properties.user="artemis-users.properties"
- org.apache.activemq.jaas.properties.role="artemis-roles.properties";
+
+activemq {
+ org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
+ debug=false
+ org.apache.activemq.jaas.properties.user="artemis-users.properties"
+ org.apache.activemq.jaas.properties.role="artemis-roles.properties";
};
\ No newline at end of file
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
index c0817907a7..fd6d1146c8 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
@@ -38,6 +38,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -50,16 +51,31 @@ public class ArtemisTest {
@Rule
public TemporaryFolder temporaryFolder;
+ private String original = System.getProperty("java.security.auth.login.config");
+
public ArtemisTest() {
File parent = new File("./target/tmp");
parent.mkdirs();
temporaryFolder = new TemporaryFolder(parent);
}
+ @Before
+ public void setup() {
+ System.setProperty("java.security.auth.login.config", temporaryFolder.getRoot().getAbsolutePath() + "/etc/login.config");
+ }
+
@After
public void cleanup() {
System.clearProperty("artemis.instance");
Run.setEmbedded(false);
+
+ if (original == null) {
+ System.clearProperty("java.security.auth.login.config");
+ }
+ else {
+ System.setProperty("java.security.auth.login.config", original);
+ }
+
Configurable.unlock();
}
@@ -102,66 +118,86 @@ public class ArtemisTest {
public void testSimpleRun() throws Exception {
String queues = "q1,t2";
String topics = "t1,t2";
+
+ // This is usually set when run from the command line via artemis.profile
Run.setEmbedded(true);
- Artemis.main("create", temporaryFolder.getRoot().getAbsolutePath(), "--force", "--silent", "--no-web", "--queues", queues, "--topics", topics, "--no-autotune");
+ Artemis.main("create", temporaryFolder.getRoot().getAbsolutePath(), "--force", "--silent", "--no-web", "--queues", queues, "--topics", topics, "--no-autotune", "--require-login");
System.setProperty("artemis.instance", temporaryFolder.getRoot().getAbsolutePath());
// Some exceptions may happen on the initialization, but they should be ok on start the basic core protocol
Artemis.internalExecute("run");
- try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
- ClientSessionFactory factory = locator.createSessionFactory();
- ClientSession coreSession = factory.createSession()) {
- for (String str : queues.split(",")) {
- ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString("jms.queue." + str));
- Assert.assertTrue("Couldn't find queue " + str, queryResult.isExists());
+ try {
+ try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
+ ClientSessionFactory factory = locator.createSessionFactory();
+ ClientSession coreSession = factory.createSession("admin", "admin", false, true, true, false, 0)) {
+ for (String str : queues.split(",")) {
+ ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString("jms.queue." + str));
+ Assert.assertTrue("Couldn't find queue " + str, queryResult.isExists());
+ }
+ for (String str : topics.split(",")) {
+ ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString("jms.topic." + str));
+ Assert.assertTrue("Couldn't find topic " + str, queryResult.isExists());
+ }
}
- for (String str : topics.split(",")) {
- ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString("jms.topic." + str));
- Assert.assertTrue("Couldn't find topic " + str, queryResult.isExists());
- }
- }
- Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("producer", "--message-count", "100", "--verbose"));
- Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("consumer", "--verbose", "--break-on-null", "--receive-timeout", "100"));
+ Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("producer", "--message-count", "100", "--verbose", "--user", "admin", "--password", "admin"));
+ Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("consumer", "--verbose", "--break-on-null", "--receive-timeout", "100", "--user", "admin", "--password", "admin"));
- ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
- Connection connection = cf.createConnection();
- Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
- MessageProducer producer = session.createProducer(ActiveMQDestination.createDestination("queue://TEST", ActiveMQDestination.QUEUE_TYPE));
+ ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
+ Connection connection = cf.createConnection("admin", "admin");
+ Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
+ MessageProducer producer = session.createProducer(ActiveMQDestination.createDestination("queue://TEST", ActiveMQDestination.QUEUE_TYPE));
- TextMessage message = session.createTextMessage("Banana");
- message.setStringProperty("fruit", "banana");
- producer.send(message);
-
- for (int i = 0; i < 100; i++) {
- message = session.createTextMessage("orange");
- message.setStringProperty("fruit", "orange");
+ TextMessage message = session.createTextMessage("Banana");
+ message.setStringProperty("fruit", "banana");
producer.send(message);
+
+ for (int i = 0; i < 100; i++) {
+ message = session.createTextMessage("orange");
+ message.setStringProperty("fruit", "orange");
+ producer.send(message);
+ }
+ session.commit();
+
+ connection.close();
+ cf.close();
+
+ Assert.assertEquals(Integer.valueOf(1), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--filter", "fruit='banana'", "--user", "admin", "--password", "admin"));
+
+ Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--filter", "fruit='orange'", "--user", "admin", "--password", "admin"));
+
+ Assert.assertEquals(Integer.valueOf(101), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--user", "admin", "--password", "admin"));
+
+ // should only receive 10 messages on browse as I'm setting messageCount=10
+ Assert.assertEquals(Integer.valueOf(10), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--message-count", "10", "--user", "admin", "--password", "admin"));
+
+ // Nothing was consumed until here as it was only browsing, check it's receiving again
+ Assert.assertEquals(Integer.valueOf(1), Artemis.internalExecute("consumer", "--txt-size", "50", "--verbose", "--break-on-null", "--receive-timeout", "100", "--filter", "fruit='banana'", "--user", "admin", "--password", "admin"));
+
+ // Checking it was acked before
+ Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("consumer", "--txt-size", "50", "--verbose", "--break-on-null", "--receive-timeout", "100", "--user", "admin", "--password", "admin"));
}
- session.commit();
+ finally {
+ stopServer();
+ }
+ }
- connection.close();
- cf.close();
+ @Test
+ public void testAnonymousAutoCreate() throws Exception {
+ // This is usually set when run from the command line via artemis.profile
- Assert.assertEquals(Integer.valueOf(1), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--filter", "fruit='banana'"));
-
- Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--filter", "fruit='orange'"));
-
- Assert.assertEquals(Integer.valueOf(101), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose"));
-
- // should only receive 10 messages on browse as I'm setting messageCount=10
- Assert.assertEquals(Integer.valueOf(10), Artemis.internalExecute("browser", "--txt-size", "50", "--verbose", "--message-count", "10"));
-
- // Nothing was consumed until here as it was only browsing, check it's receiving again
- Assert.assertEquals(Integer.valueOf(1), Artemis.internalExecute("consumer", "--txt-size", "50", "--verbose", "--break-on-null", "--receive-timeout", "100", "--filter", "fruit='banana'"));
-
- // Checking it was acked before
- Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("consumer", "--txt-size", "50", "--verbose", "--break-on-null", "--receive-timeout", "100"));
-
- Artemis.internalExecute("stop");
- Assert.assertTrue(Run.latchRunning.await(5, TimeUnit.SECONDS));
- Assert.assertEquals(0, LibaioContext.getTotalMaxIO());
+ Run.setEmbedded(true);
+ Artemis.main("create", temporaryFolder.getRoot().getAbsolutePath(), "--force", "--silent", "--no-web", "--no-autotune", "--allow-anonymous", "--user", "a", "--password", "a", "--role", "a");
+ System.setProperty("artemis.instance", temporaryFolder.getRoot().getAbsolutePath());
+ // Some exceptions may happen on the initialization, but they should be ok on start the basic core protocol
+ Artemis.internalExecute("run");
+ try {
+ Assert.assertEquals(Integer.valueOf(100), Artemis.internalExecute("producer", "--message-count", "100"));
+ }
+ finally {
+ stopServer();
+ }
}
private void testCli(String... args) {
@@ -174,9 +210,15 @@ public class ArtemisTest {
}
}
-
public boolean isWindows() {
return System.getProperty("os.name", "null").toLowerCase().indexOf("win") >= 0;
-
}
+
+ private void stopServer() throws Exception {
+ Artemis.internalExecute("stop");
+ Assert.assertTrue(Run.latchRunning.await(5, TimeUnit.SECONDS));
+ Assert.assertEquals(0, LibaioContext.getTotalMaxIO());
+ }
+
+
}
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/FileBrokerTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/FileBrokerTest.java
index c796f3f3d1..0feaf8fb7e 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/FileBrokerTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/FileBrokerTest.java
@@ -20,7 +20,7 @@ import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.dto.ServerDTO;
import org.apache.activemq.artemis.integration.FileBroker;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.junit.Assert;
import org.junit.Test;
@@ -32,7 +32,7 @@ public class FileBrokerTest {
serverDTO.configuration = "broker.xml";
FileBroker broker = null;
try {
- broker = new FileBroker(serverDTO, new ActiveMQSecurityManagerImpl());
+ broker = new FileBroker(serverDTO, new ActiveMQJAASSecurityManager());
broker.start();
JMSServerManagerImpl jmsServerManager = (JMSServerManagerImpl) broker.getComponents().get("jms");
Assert.assertNotNull(jmsServerManager);
@@ -57,7 +57,7 @@ public class FileBrokerTest {
serverDTO.configuration = "broker-nojms.xml";
FileBroker broker = null;
try {
- broker = new FileBroker(serverDTO, new ActiveMQSecurityManagerImpl());
+ broker = new FileBroker(serverDTO, new ActiveMQJAASSecurityManager());
broker.start();
JMSServerManagerImpl jmsServerManager = (JMSServerManagerImpl) broker.getComponents().get("jms");
Assert.assertNull(jmsServerManager);
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java
index e1d045d05e..21579dc9b0 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java
@@ -40,8 +40,7 @@ public class StreamClassPathTest {
openStream(Create.ETC_LOGGING_PROPERTIES);
openStream(Create.ETC_BOOTSTRAP_XML);
openStream(Create.ETC_BROKER_XML);
- openStream(Create.ETC_ARTEMIS_ROLES_BASIC_PROPERTIES);
- openStream(Create.ETC_ARTEMIS_ROLES_JAAS_PROPERTIES);
+ openStream(Create.ETC_ARTEMIS_ROLES_PROPERTIES);
openStream(Create.ETC_ARTEMIS_USERS_PROPERTIES);
openStream(Create.ETC_REPLICATED_SETTINGS_TXT);
openStream(Create.ETC_REPLICATED_SETTINGS_TXT);
@@ -51,8 +50,6 @@ public class StreamClassPathTest {
openStream(Create.ETC_CONNECTOR_SETTINGS_TXT);
openStream(Create.ETC_BOOTSTRAP_WEB_SETTINGS_TXT);
openStream(Create.ETC_JOURNAL_BUFFER_SETTINGS);
- openStream(Create.ETC_JAAS_BROKER_SECURITY_SETTINGS_TXT);
- openStream(Create.ETC_BASIC_BROKER_SECURITY_SETTINGS_TXT);
}
private void openStream(String source) throws Exception {
diff --git a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/BasicSecurityDTO.java b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/BasicSecurityDTO.java
deleted file mode 100644
index cc1ede1d0b..0000000000
--- a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/BasicSecurityDTO.java
+++ /dev/null
@@ -1,42 +0,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.
- */
-package org.apache.activemq.artemis.dto;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "basic-security")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class BasicSecurityDTO extends SecurityDTO {
-
- @XmlAttribute(required = true)
- public String users;
-
- @XmlAttribute(required = true)
- public String roles;
-
- @XmlAttribute(name = "default-user")
- public String defaultUser;
-
- @XmlAttribute(name = "mask-password")
- public Boolean maskPassword = false;
-
- @XmlAttribute
- public String passwordCodec;
-}
diff --git a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/JaasSecurityDTO.java b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/JaasSecurityDTO.java
index 99163cf55c..a988bff51f 100644
--- a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/JaasSecurityDTO.java
+++ b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/JaasSecurityDTO.java
@@ -25,6 +25,6 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlAccessorType(XmlAccessType.FIELD)
public class JaasSecurityDTO extends SecurityDTO {
- @XmlAttribute(name = "login-module", required = true)
- public String loginModule;
+ @XmlAttribute(name = "domain", required = true)
+ public String domain;
}
diff --git a/artemis-dto/src/main/resources/org/apache/activemq/artemis/dto/jaxb.index b/artemis-dto/src/main/resources/org/apache/activemq/artemis/dto/jaxb.index
index b0bacd7ba7..94f0b2d2cb 100644
--- a/artemis-dto/src/main/resources/org/apache/activemq/artemis/dto/jaxb.index
+++ b/artemis-dto/src/main/resources/org/apache/activemq/artemis/dto/jaxb.index
@@ -16,6 +16,5 @@
## ---------------------------------------------------------------------------
BrokerDTO
SecurityDTO
-BasicSecurityDTO
JaasSecurityDTO
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
index ba6cb8e045..39b6d8eeda 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
@@ -113,9 +113,6 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
@Parameter(defaultValue = "ON_DEMAND")
private String messageLoadBalancing;
- @Parameter(defaultValue = "basic")
- private String brokerSecurity;
-
/**
* For extra stuff not covered by the properties
*/
@@ -203,7 +200,7 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
ArrayList listCommands = new ArrayList<>();
- add(listCommands, "create", "--allow-anonymous", "--silent", "--force", "--no-web", "--user", user, "--password", password, "--role", role, "--port-offset", "" + portOffset, "--data", dataFolder, "--broker-security", brokerSecurity);
+ add(listCommands, "create", "--allow-anonymous", "--silent", "--force", "--no-web", "--user", user, "--password", password, "--role", role, "--port-offset", "" + portOffset, "--data", dataFolder);
if (allowAnonymous) {
add(listCommands, "--allow-anonymous");
diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java
index a869dafae8..91f927c0ee 100644
--- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java
+++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java
@@ -27,11 +27,12 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.core.config.impl.FileSecurityConfiguration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.rest.HttpHeaderProperty;
import org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQJMS;
import org.apache.activemq.artemis.spi.core.naming.BindingRegistry;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@@ -49,9 +50,12 @@ public class EmbeddedTest {
public static void startEmbedded() throws Exception {
server = new EmbeddedRestActiveMQJMS();
server.getManager().setConfigResourcePath("activemq-rest.xml");
- FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration("artemis-users.properties", "artemis-roles.properties", "guest", false, null);
- securityConfiguration.start();
- server.getEmbeddedJMS().setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfiguration));
+ SecurityConfiguration securityConfiguration = new SecurityConfiguration();
+ securityConfiguration.addUser("guest", "guest");
+ securityConfiguration.addRole("guest", "guest");
+ securityConfiguration.setDefaultUser("guest");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfiguration);
+ server.getEmbeddedJMS().setSecurityManager(securityManager);
server.start();
List connectors = new ArrayList<>();
connectors.add("in-vm");
diff --git a/artemis-rest/src/test/resources/artemis-roles.properties b/artemis-rest/src/test/resources/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/artemis-rest/src/test/resources/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/artemis-rest/src/test/resources/artemis-users.properties b/artemis-rest/src/test/resources/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/artemis-rest/src/test/resources/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java
index 0dce1da208..8fb14c0a68 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java
@@ -24,6 +24,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.utils.PasswordMaskingUtil;
import org.apache.activemq.artemis.utils.SensitiveDataCodec;
+@Deprecated
public class FileSecurityConfiguration extends SecurityConfiguration {
private final String usersUrl;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java
index afbbe5e2ef..d647802d46 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java
@@ -16,8 +16,12 @@
*/
package org.apache.activemq.artemis.core.config.impl;
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+
import org.apache.activemq.artemis.core.security.User;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import java.util.ArrayList;
import java.util.HashMap;
@@ -25,7 +29,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-public class SecurityConfiguration {
+public class SecurityConfiguration extends Configuration {
/**
* the current valid users
@@ -104,4 +108,13 @@ public class SecurityConfiguration {
public List getRole(String username) {
return roles.get(username);
}
+
+ @Override
+ public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
+ Map map = new HashMap<>();
+ map.put(InVMLoginModule.CONFIG_PROP_NAME, this);
+ AppConfigurationEntry appConfigurationEntry = new AppConfigurationEntry(name, AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, map);
+
+ return new AppConfigurationEntry[] {appConfigurationEntry};
+ }
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServers.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServers.java
index 1f14833ea8..4bdfd5b31c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServers.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServers.java
@@ -16,14 +16,15 @@
*/
package org.apache.activemq.artemis.core.server;
+import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;
-import javax.management.MBeanServer;
-
import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
/**
* ActiveMQServers is a factory class for instantiating ActiveMQServer instances.
@@ -38,7 +39,7 @@ public final class ActiveMQServers {
}
public static ActiveMQServer newActiveMQServer(final Configuration config, final boolean enablePersistence) {
- ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager, enablePersistence);
@@ -52,7 +53,7 @@ public final class ActiveMQServers {
public static ActiveMQServer newActiveMQServer(final Configuration config,
final MBeanServer mbeanServer,
final boolean enablePersistence) {
- ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, mbeanServer, securityManager, enablePersistence);
@@ -83,7 +84,7 @@ public final class ActiveMQServers {
}
public static ActiveMQServer newActiveMQServer(Configuration config, String defUser, String defPass) {
- ActiveMQSecurityManagerImpl securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
securityManager.getConfiguration().addUser(defUser, defPass);
@@ -97,9 +98,9 @@ public final class ActiveMQServers {
final boolean enablePersistence,
String user,
String password) {
- ActiveMQSecurityManagerImpl securityManager = new ActiveMQSecurityManagerImpl();
-
- securityManager.getConfiguration().addUser(user, password);
+ SecurityConfiguration securityConfiguration = new SecurityConfiguration();
+ securityConfiguration.addUser(user, password);
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfiguration);
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, mbeanServer, securityManager, enablePersistence);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/embedded/EmbeddedActiveMQ.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/embedded/EmbeddedActiveMQ.java
index 86bbe91896..fc77bdcd53 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/embedded/EmbeddedActiveMQ.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/embedded/EmbeddedActiveMQ.java
@@ -23,8 +23,8 @@ import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
/**
* Helper class to simplify bootstrap of ActiveMQ Artemis server. Bootstraps from classpath-based config files.
@@ -95,7 +95,7 @@ public class EmbeddedActiveMQ {
configuration = config;
}
if (securityManager == null) {
- securityManager = new ActiveMQSecurityManagerImpl();
+ securityManager = new ActiveMQJAASSecurityManager();
}
if (mbeanServer == null) {
activeMQServer = new ActiveMQServerImpl(configuration, securityManager);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java
index 71f4511eda..eebc6aba23 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java
@@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection;
import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
@@ -45,10 +46,23 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
private final boolean trace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private String configurationName;
+ private SecurityConfiguration configuration;
+
+ public ActiveMQJAASSecurityManager() {
+ }
+
+ public ActiveMQJAASSecurityManager(String configurationName) {
+ this.configurationName = configurationName;
+ }
+
+ public ActiveMQJAASSecurityManager(String configurationName, SecurityConfiguration configuration) {
+ this.configurationName = configurationName;
+ this.configuration = configuration;
+ }
@Override
public boolean validateUser(String user, String password) {
- throw new UnsupportedOperationException("Invoke validateUser(String, String, X509Certificate[]) instead");
+ return validateUser(user, password, null);
}
@Override
@@ -99,9 +113,10 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
Iterator rolesForSubjectIter = rolesForSubject.iterator();
while (!authorized && rolesForSubjectIter.hasNext()) {
Iterator rolesWithPermissionIter = rolesWithPermission.iterator();
+ Principal subjectRole = rolesForSubjectIter.next();
while (!authorized && rolesWithPermissionIter.hasNext()) {
- Principal role = rolesWithPermissionIter.next();
- authorized = rolesForSubjectIter.next().equals(role);
+ Principal roleWithPermission = rolesWithPermissionIter.next();
+ authorized = subjectRole.equals(roleWithPermission);
}
}
}
@@ -115,7 +130,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
}
private Subject getAuthenticatedSubject(final String user, final String password, final X509Certificate[] certificates) throws LoginException {
- LoginContext lc = new LoginContext(configurationName, new JaasCallbackHandler(user, password, certificates));
+ LoginContext lc = new LoginContext(configurationName, null, new JaasCallbackHandler(user, password, certificates), configuration);
lc.login();
return lc.getSubject();
}
@@ -133,4 +148,16 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
public void setConfigurationName(final String configurationName) {
this.configurationName = configurationName;
}
+
+ public void setConfiguration(SecurityConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ public SecurityConfiguration getConfiguration() {
+ if (configuration == null) {
+ configuration = new SecurityConfiguration();
+ }
+
+ return configuration;
+ }
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
index a9d4991ccc..b60d8b0dd5 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
@@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
* A basic implementation of the ActiveMQSecurityManager. This can be used within an appserver and be deployed by
* BasicUserCredentialsDeployer or used standalone or embedded.
*/
+@Deprecated
public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager {
private final SecurityConfiguration configuration;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java
index dbea86bad5..22da502ad4 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java
@@ -106,7 +106,7 @@ public class GuestLoginModule implements LoginModule {
}
if (debug) {
- ActiveMQServerLogger.LOGGER.debug("commit");
+ ActiveMQServerLogger.LOGGER.debug("commit: " + loginSucceeded);
}
return loginSucceeded;
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java
new file mode 100644
index 0000000000..d91d6395d8
--- /dev/null
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ */
+package org.apache.activemq.artemis.spi.core.security.jaas;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.FailedLoginException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import java.io.IOException;
+import java.security.Principal;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+
+public class InVMLoginModule implements LoginModule {
+ public static final String CONFIG_PROP_NAME = "org.apache.activemq.jaas.invm.config";
+
+ private SecurityConfiguration configuration;
+ private Subject subject;
+ private String user;
+ private Set principals = new HashSet();
+ private CallbackHandler callbackHandler;
+ private boolean loginSucceeded;
+
+ @Override
+ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
+ this.subject = subject;
+ this.callbackHandler = callbackHandler;
+ this.configuration = (SecurityConfiguration) options.get(CONFIG_PROP_NAME);
+ }
+
+ @Override
+ public boolean login() throws LoginException {
+ Callback[] callbacks = new Callback[2];
+
+ callbacks[0] = new NameCallback("Username: ");
+ callbacks[1] = new PasswordCallback("Password: ", false);
+ try {
+ callbackHandler.handle(callbacks);
+ }
+ catch (IOException ioe) {
+ throw new LoginException(ioe.getMessage());
+ }
+ catch (UnsupportedCallbackException uce) {
+ throw new LoginException(uce.getMessage() + " not available to obtain information from user");
+ }
+ user = ((NameCallback) callbacks[0]).getName();
+ char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
+ if (tmpPassword == null) {
+ tmpPassword = new char[0];
+ }
+ if (user == null) {
+ if (configuration.getDefaultUser() == null) {
+ throw new FailedLoginException("Both username and defaultUser are null");
+ }
+ else {
+ user = configuration.getDefaultUser();
+ }
+ }
+ else {
+ String password = configuration.getUser(user) == null ? null : configuration.getUser(user).getPassword();
+
+ if (password == null) {
+ throw new FailedLoginException("User does not exist");
+ }
+ if (!password.equals(new String(tmpPassword))) {
+ throw new FailedLoginException("Password does not match");
+ }
+ }
+ loginSucceeded = true;
+
+ ActiveMQServerLogger.LOGGER.debug("login " + user);
+
+ return loginSucceeded;
+ }
+
+ @Override
+ public boolean commit() throws LoginException {
+ boolean result = loginSucceeded;
+ if (result) {
+ principals.add(new UserPrincipal(user));
+
+ List roles = configuration.getRole(user);
+
+ if (roles != null) {
+ for (String role : roles) {
+ principals.add(new RolePrincipal(role));
+ }
+ }
+
+ subject.getPrincipals().addAll(principals);
+ }
+
+ // will whack loginSucceeded
+ clear();
+
+ ActiveMQServerLogger.LOGGER.debug("commit, result: " + result);
+
+ return result;
+ }
+
+ @Override
+ public boolean abort() throws LoginException {
+ clear();
+
+ ActiveMQServerLogger.LOGGER.debug("abort");
+
+ return true;
+ }
+
+ private void clear() {
+ user = null;
+ loginSucceeded = false;
+ }
+
+ @Override
+ public boolean logout() throws LoginException {
+ subject.getPrincipals().removeAll(principals);
+ principals.clear();
+ clear();
+
+ ActiveMQServerLogger.LOGGER.debug("logout");
+
+ return true;
+ }
+}
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
index 76ac5ab0bb..3765e60bd3 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
@@ -79,13 +79,14 @@ import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.core.io.SequentialFileFactory;
+import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory;
import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
import org.apache.activemq.artemis.core.journal.RecordInfo;
-import org.apache.activemq.artemis.core.io.SequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.JournalFile;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
import org.apache.activemq.artemis.core.journal.impl.JournalReaderCallback;
-import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory;
import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl;
import org.apache.activemq.artemis.core.postoffice.Binding;
@@ -121,8 +122,9 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.jlibaio.LibaioContext;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.After;
@@ -1412,7 +1414,7 @@ public abstract class ActiveMQTestBase extends Assert {
NodeManager nodeManager,
final int id) {
ActiveMQServer server;
- ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
configuration.setPersistenceEnabled(realFiles);
server = addServer(new InVMNodeManagerServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, nodeManager));
@@ -1453,7 +1455,7 @@ public abstract class ActiveMQTestBase extends Assert {
NodeManager backupNodeManager,
final int id) {
ActiveMQServer server;
- ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
configuration.setPersistenceEnabled(realFiles);
server = new ColocatedActiveMQServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, liveNodeManager, backupNodeManager);
diff --git a/examples/features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties b/examples/features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties b/examples/features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
index 7d00c7e05a..334c58f570 100644
--- a/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
+++ b/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
@@ -16,12 +16,6 @@
*/
package org.apache.activemq.artemis.jms.example;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
-import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
-
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -33,6 +27,13 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.jms.server.JMSServerManager;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
+
/**
* This example demonstrates how to run an ActiveMQ Artemis embedded with JMS
*/
@@ -45,7 +46,8 @@ public class EmbeddedExample {
securityConfig.addUser("guest", "guest");
securityConfig.addRole("guest", "guest");
securityConfig.setDefaultUser("guest");
- jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfig);
+ jmsServer.setSecurityManager(securityManager);
jmsServer.start();
System.out.println("Started Embedded JMS Server");
diff --git a/examples/features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/interceptor/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/interceptor/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/interceptor/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/interceptor/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/interceptor/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/interceptor/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/artemis-roles.properties b/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/artemis-users.properties b/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jmx/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/jmx/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jmx/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/jmx/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/jmx/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/jmx/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/management-notifications/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/management-notifications/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/management-notifications/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/management-notifications/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/management-notifications/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/management-notifications/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/management/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/management/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/management/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/management/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/management/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/management/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/message-counters/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/message-counters/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/message-counters/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/message-counters/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/message-counters/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/message-counters/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/paging/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/paging/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/paging/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/paging/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/paging/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/paging/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/pom.xml b/examples/features/standard/pom.xml
index eaf9b38765..d900cb67bb 100644
--- a/examples/features/standard/pom.xml
+++ b/examples/features/standard/pom.xml
@@ -82,7 +82,6 @@ under the License.
request-replyscheduled-messagesecurity
- security-jaassend-acknowledgementsspring-integrationssl-enabled
diff --git a/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/reattach-node/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index d82bc7ed6d..0000000000
--- a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest,admin
\ No newline at end of file
diff --git a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/reattach-node/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml
index 07e09bba6f..f646990283 100644
--- a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml
@@ -71,10 +71,9 @@ under the License.
-
-
-
-
+
+
+
diff --git a/examples/features/standard/security-jaas/pom.xml b/examples/features/standard/security-jaas/pom.xml
deleted file mode 100644
index ff975a319b..0000000000
--- a/examples/features/standard/security-jaas/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.apache.activemq.examples.broker
- jms-examples
- 1.1.1-SNAPSHOT
-
-
- security-jaas
- jar
- ActiveMQ Artemis JMS JAAS Security Example
-
-
- ${project.basedir}/../../../..
-
-
-
-
- org.apache.activemq
- artemis-jms-client
- ${project.version}
-
-
-
-
-
-
- org.apache.activemq
- artemis-maven-plugin
-
-
- create
-
- create
-
-
- ${noServer}
- jaas
-
-
-
- start
-
- cli
-
-
- ${noServer}
- true
- tcp://localhost:61616
- bill
- activemq
-
- run
-
-
-
-
- runClient
-
- runClient
-
-
- org.apache.activemq.artemis.jms.example.JaasSecurityExample
-
-
-
- stop
-
- cli
-
-
- ${noServer}
-
- stop
-
-
-
-
-
-
- org.apache.activemq.examples.broker
- security-jaas
- ${project.version}
-
-
-
-
-
-
-
diff --git a/examples/features/standard/security-jaas/readme.html b/examples/features/standard/security-jaas/readme.html
deleted file mode 100644
index 9a678f6929..0000000000
--- a/examples/features/standard/security-jaas/readme.html
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
-
-
- ActiveMQ Artemis JMS Security Example
-
-
-
-
-
-
JMS JAAS Security Example
-
-
To run the example, simply type mvn verify from this directory, or mvn -PnoServer verify if you want to start and create the server manually.
-
-
-
This example shows how to configure and use JAAS security using ActiveMQ Artemis.
-
-
With security properly configured, ActiveMQ Artemis can restrict client access to its resources, including
- connection creation, message sending/receiving, etc. This is done by configuring users and roles as well as permissions in
- the configuration files.
-
-
ActiveMQ Artemis supports wild-card security configuration. This feature makes security configuration very
- flexible and enables fine-grained control over permissions in an efficient way.
-
-
For a full description of how to configure security with ActiveMQ Artemis, please consult the user
- manual.
-
-
This example demonstrates how to configure users/roles using a JAAS login module, how to configure topics with
- proper permissions using wild-card expressions, and how they take effects in a simple program.
-
-
First we need to configure users with roles. Since this example is using the PropertiesLogin JAAS
- login module the users and roles are configured in artemis-users.properties and
- artemis-roles.properties which are referenced from the login module's configuration in login.config.
- This example has four users configured as below:
- Each user has three properties available: user name, password, and roles it belongs to. It should be noted that
- a user can belong to more than one role. In the above configuration, all users belong to role 'user'. User 'andrew' also
- belongs to role 'europe-user', user 'frank' also belongs to 'us-user' and 'news-user' and user 'sam' also belongs to 'news-user'.
-
-
- User name and password consists of a valid account that can be used to establish connections to a ActiveMQ Artemis server, while
- roles are used in controlling the access privileges against ActiveMQ Artemis topics and queues. You can achieve this control by
- configuring proper permissions in broker.xml, like the following
-
Permissions can be defined on any group of queues, by using a wildcard. You can easily specify
- wildcards to apply certain permissions to a set of matching queues and topics. In the above configuration
- we have created four sets of permissions, each set matches against a special group of targets, indicated by wild-card match attributes.
-
-
You can provide a very broad permission control as a default and then add more strict control
- over specific addresses. By the above we define the following access rules:
-
-
Only role 'us-user' can create/delete and pulish messages to topics whose names match wild-card pattern 'news.us.#'.
-
Only role 'europe-user' can create/delete and publish messages to topics whose names match wild-card pattern 'news.europe.#'.
-
Only role 'news-user' can subscribe messages to topics whose names match wild-card pattern 'news.us.#' and 'news.europe.#'.
-
For any other topics that don't match any of the above wild-card patterns, permissions are granted to users of role 'user'.
-
-
To illustrate the effect of permissions, three topics are deployed. Topic 'genericTopic' matches 'jms.topic.#' wild-card, topic 'news.europe.europeTopic' matches
- jms.topic.news.europe.#' wild-cards, and topic 'news.us.usTopic' matches 'jms.topic.news.us.#'.
-
-
With ActiveMQ Artemis, the security manager is also configurable. You can use JAASSecurityManager or JBossASSecurityManager based on you need. Please
- check out the activemq-beans.xml for how to do. In this example we just use the basic ActiveMQSecurityManagerImpl which reads users/roles/passwords from the xml
- file activemq-users.xml.
-
-
-
Example step-by-step
-
To run the example, simply type mvn verify -Pexample from this directory
-
-
-
First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the client-jndi.properties file in the directory ../common/config
And finally, always remember to close your JMS connections and resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
-
-
-
- finally
- {
- if (billConnection != null)
- {
- billConnection.close();
- }
- if (andrewConnection != null)
- {
- andrewConnection.close();
- }
- if (frankConnection != null)
- {
- frankConnection.close();
- }
- if (samConnection != null)
- {
- samConnection.close();
- }
-
- // Also the initialContext
- if (initialContext != null)
- {
- initialContext.close();
- }
- }
-
-
-
-
-
diff --git a/examples/features/standard/security-jaas/src/main/java/org/apache/activemq/artemis/jms/example/JaasSecurityExample.java b/examples/features/standard/security-jaas/src/main/java/org/apache/activemq/artemis/jms/example/JaasSecurityExample.java
deleted file mode 100644
index eae3fdde17..0000000000
--- a/examples/features/standard/security-jaas/src/main/java/org/apache/activemq/artemis/jms/example/JaasSecurityExample.java
+++ /dev/null
@@ -1,282 +0,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.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.JMSSecurityException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
-public class JaasSecurityExample {
-
- public static void main(final String[] args) throws Exception {
- boolean result = true;
- Connection failConnection = null;
- Connection billConnection = null;
- Connection andrewConnection = null;
- Connection frankConnection = null;
- Connection samConnection = null;
-
- InitialContext initialContext = null;
- try {
- // /Step 1. Create an initial context to perform the JNDI lookup.
- initialContext = new InitialContext();
-
- // Step 2. perform lookup on the topics
- Topic genericTopic = (Topic) initialContext.lookup("topic/genericTopic");
- Topic europeTopic = (Topic) initialContext.lookup("topic/europeTopic");
- Topic usTopic = (Topic) initialContext.lookup("topic/usTopic");
-
- // Step 3. perform a lookup on the Connection Factory
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 4. Try to create a JMS Connection without user/password. It will fail.
- try {
- failConnection = cf.createConnection();
- result = false;
- }
- catch (JMSSecurityException e) {
- System.out.println("Default user cannot get a connection. Details: " + e.getMessage());
- }
-
- // Step 5. bill tries to make a connection using wrong password
- billConnection = null;
- try {
- billConnection = createConnection("bill", "activemq1", cf);
- result = false;
- }
- catch (JMSException e) {
- System.out.println("User bill failed to connect. Details: " + e.getMessage());
- }
-
- // Step 6. bill makes a good connection.
- billConnection = createConnection("bill", "activemq", cf);
- billConnection.start();
-
- // Step 7. andrew makes a good connection.
- andrewConnection = createConnection("andrew", "activemq1", cf);
- andrewConnection.start();
-
- // Step 8. frank makes a good connection.
- frankConnection = createConnection("frank", "activemq2", cf);
- frankConnection.start();
-
- // Step 9. sam makes a good connection.
- samConnection = createConnection("sam", "activemq3", cf);
- samConnection.start();
-
- // Step 10. Check every user can publish/subscribe genericTopics.
- System.out.println("------------------------Checking permissions on " + genericTopic + "----------------");
- checkUserSendAndReceive(genericTopic, billConnection, "bill");
- checkUserSendAndReceive(genericTopic, andrewConnection, "andrew");
- checkUserSendAndReceive(genericTopic, frankConnection, "frank");
- checkUserSendAndReceive(genericTopic, samConnection, "sam");
- System.out.println("-------------------------------------------------------------------------------------");
-
- System.out.println("------------------------Checking permissions on " + europeTopic + "----------------");
-
- // Step 11. Check permissions on news.europe.europeTopic for bill: can't send and can't receive
- checkUserNoSendNoReceive(europeTopic, billConnection, "bill");
-
- // Step 12. Check permissions on news.europe.europeTopic for andrew: can send but can't receive
- checkUserSendNoReceive(europeTopic, andrewConnection, "andrew", frankConnection);
-
- // Step 13. Check permissions on news.europe.europeTopic for frank: can't send but can receive
- checkUserReceiveNoSend(europeTopic, frankConnection, "frank", andrewConnection);
-
- // Step 14. Check permissions on news.europe.europeTopic for sam: can't send but can receive
- checkUserReceiveNoSend(europeTopic, samConnection, "sam", andrewConnection);
- System.out.println("-------------------------------------------------------------------------------------");
-
- System.out.println("------------------------Checking permissions on " + usTopic + "----------------");
-
- // Step 15. Check permissions on news.us.usTopic for bill: can't send and can't receive
- checkUserNoSendNoReceive(usTopic, billConnection, "bill");
-
- // Step 16. Check permissions on news.us.usTopic for andrew: can't send and can't receive
- checkUserNoSendNoReceive(usTopic, andrewConnection, "andrew");
-
- // Step 17. Check permissions on news.us.usTopic for frank: can both send and receive
- checkUserSendAndReceive(usTopic, frankConnection, "frank");
-
- // Step 18. Check permissions on news.us.usTopic for sam: can't send but can receive
- checkUserReceiveNoSend(usTopic, samConnection, "sam", frankConnection);
- System.out.println("-------------------------------------------------------------------------------------");
- }
- finally {
- // Step 19. Be sure to close our JMS resources!
- if (failConnection != null) {
- failConnection.close();
- }
- if (billConnection != null) {
- billConnection.close();
- }
- if (andrewConnection != null) {
- andrewConnection.close();
- }
- if (frankConnection != null) {
- frankConnection.close();
- }
- if (samConnection != null) {
- samConnection.close();
- }
-
- // Also the initialContext
- if (initialContext != null) {
- initialContext.close();
- }
- }
- }
-
- // Check the user can receive message but cannot send message.
- private static void checkUserReceiveNoSend(final Topic topic,
- final Connection connection,
- final String user,
- final Connection sendingConn) throws JMSException {
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = session.createProducer(topic);
- MessageConsumer consumer = session.createConsumer(topic);
- TextMessage msg = session.createTextMessage("hello-world-1");
-
- try {
- producer.send(msg);
- throw new IllegalStateException("Security setting is broken! User " + user +
- " can send message [" +
- msg.getText() +
- "] to topic " +
- topic);
- }
- catch (JMSException e) {
- System.out.println("User " + user + " cannot send message [" + msg.getText() + "] to topic: " + topic);
- }
-
- // Now send a good message
- Session session1 = sendingConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- producer = session1.createProducer(topic);
- producer.send(msg);
-
- TextMessage receivedMsg = (TextMessage) consumer.receive(2000);
-
- if (receivedMsg != null) {
- System.out.println("User " + user + " can receive message [" + receivedMsg.getText() + "] from topic " + topic);
- }
- else {
- throw new IllegalStateException("Security setting is broken! User " + user + " cannot receive message from topic " + topic);
- }
-
- session1.close();
- session.close();
- }
-
- // Check the user can send message but cannot receive message
- private static void checkUserSendNoReceive(final Topic topic,
- final Connection connection,
- final String user,
- final Connection receivingConn) throws JMSException {
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = session.createProducer(topic);
- try {
- session.createConsumer(topic);
- }
- catch (JMSException e) {
- System.out.println("User " + user + " cannot receive any message from topic " + topic);
- }
-
- Session session1 = receivingConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer goodConsumer = session1.createConsumer(topic);
-
- TextMessage msg = session.createTextMessage("hello-world-2");
- producer.send(msg);
-
- TextMessage receivedMsg = (TextMessage) goodConsumer.receive(2000);
- if (receivedMsg != null) {
- System.out.println("User " + user + " can send message [" + receivedMsg.getText() + "] to topic " + topic);
- }
- else {
- throw new IllegalStateException("Security setting is broken! User " + user +
- " cannot send message [" +
- msg.getText() +
- "] to topic " +
- topic);
- }
-
- session.close();
- session1.close();
- }
-
- // Check the user has neither send nor receive permission on topic
- private static void checkUserNoSendNoReceive(final Topic topic,
- final Connection connection,
- final String user) throws JMSException {
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = session.createProducer(topic);
-
- try {
- session.createConsumer(topic);
- }
- catch (JMSException e) {
- System.out.println("User " + user + " cannot create consumer on topic " + topic);
- }
-
- TextMessage msg = session.createTextMessage("hello-world-3");
- try {
- producer.send(msg);
- throw new IllegalStateException("Security setting is broken! User " + user +
- " can send message [" +
- msg.getText() +
- "] to topic " +
- topic);
- }
- catch (JMSException e) {
- System.out.println("User " + user + " cannot send message [" + msg.getText() + "] to topic: " + topic);
- }
-
- session.close();
- }
-
- // Check the user connection has both send and receive permissions on the topic
- private static void checkUserSendAndReceive(final Topic topic,
- final Connection connection,
- final String user) throws JMSException {
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- TextMessage msg = session.createTextMessage("hello-world-4");
- MessageProducer producer = session.createProducer(topic);
- MessageConsumer consumer = session.createConsumer(topic);
- producer.send(msg);
- TextMessage receivedMsg = (TextMessage) consumer.receive(5000);
- if (receivedMsg != null) {
- System.out.println("User " + user + " can send message: [" + msg.getText() + "] to topic: " + topic);
- System.out.println("User " + user + " can receive message: [" + msg.getText() + "] from topic: " + topic);
- }
- else {
- throw new IllegalStateException("Error! User " + user + " cannot receive the message! ");
- }
- session.close();
- }
-
- private static Connection createConnection(final String username,
- final String password,
- final ConnectionFactory cf) throws JMSException {
- return cf.createConnection(username, password);
- }
-}
diff --git a/examples/features/standard/security-jaas/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/security-jaas/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 243b341c71..0000000000
--- a/examples/features/standard/security-jaas/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,20 +0,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.
-## ---------------------------------------------------------------------------
-user=bill,andrew,frank,sam
-europe-user=andrew
-us-user=frank
-news-user=frank,sam
\ No newline at end of file
diff --git a/examples/features/standard/security-jaas/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/security-jaas/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 0a206c6053..0000000000
--- a/examples/features/standard/security-jaas/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,20 +0,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.
-## ---------------------------------------------------------------------------
-bill=activemq
-andrew=activemq1
-frank=activemq2
-sam=activemq3
\ No newline at end of file
diff --git a/examples/features/standard/security-jaas/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/security-jaas/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index e2dc187813..0000000000
--- a/examples/features/standard/security-jaas/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ./data/messaging/bindings
-
- ./data/messaging/journal
-
- ./data/messaging/largemessages
-
- ./data/messaging/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/features/standard/security-jaas/src/main/resources/jndi.properties b/examples/features/standard/security-jaas/src/main/resources/jndi.properties
deleted file mode 100644
index 0a3b640261..0000000000
--- a/examples/features/standard/security-jaas/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,22 +0,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.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-topic.topic/genericTopic=genericTopic
-topic.topic/europeTopic=news.europe.europeTopic
-topic.topic/usTopic=news.us.usTopic
diff --git a/examples/features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties
index 09b3f5d841..71e672d40b 100644
--- a/examples/features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties
+++ b/examples/features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties
@@ -14,7 +14,7 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-bill=user
-andrew=europe-user,user
-frank=us-user,news-user,user
-sam=news-user,user
\ No newline at end of file
+user=bill,andrew,frank,sam
+europe-user=andrew
+news-user=frank,sam
+us-user=frank
\ No newline at end of file
diff --git a/examples/features/standard/spring-integration/src/main/resources/artemis-roles.properties b/examples/features/standard/spring-integration/src/main/resources/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/spring-integration/src/main/resources/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/spring-integration/src/main/resources/artemis-users.properties b/examples/features/standard/spring-integration/src/main/resources/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/spring-integration/src/main/resources/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml b/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml
index a67de7393d..274a8faef9 100644
--- a/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml
+++ b/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml
@@ -24,7 +24,8 @@ under the License.
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
+
+
diff --git a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml
index 9a7f87b619..4bf6371d07 100644
--- a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml
@@ -39,7 +39,7 @@ under the License.
- tcp://localhost:5500?sslEnabled=true;keyStorePath=activemq/server0/activemq.example.keystore;keyStorePassword=activemqexample
+ tcp://localhost:5500?sslEnabled=true;keyStorePath=${data.dir}/../etc/activemq.example.keystore;keyStorePassword=activemqexample
diff --git a/examples/features/standard/static-selector/src/main/resources/activemq/server0/artemis-roles.properties b/examples/features/standard/static-selector/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/static-selector/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/features/standard/static-selector/src/main/resources/activemq/server0/artemis-users.properties b/examples/features/standard/static-selector/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/features/standard/static-selector/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/protocols/amqp/proton-ruby/src/main/resources/activemq/server0/artemis-roles.properties b/examples/protocols/amqp/proton-ruby/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/protocols/amqp/proton-ruby/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/protocols/amqp/proton-ruby/src/main/resources/activemq/server0/artemis-users.properties b/examples/protocols/amqp/proton-ruby/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/protocols/amqp/proton-ruby/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/protocols/openwire/chat/src/main/resources/activemq/server0/artemis-roles.properties b/examples/protocols/openwire/chat/src/main/resources/activemq/server0/artemis-roles.properties
index c8f2f3dfd1..94b1329155 100644
--- a/examples/protocols/openwire/chat/src/main/resources/activemq/server0/artemis-roles.properties
+++ b/examples/protocols/openwire/chat/src/main/resources/activemq/server0/artemis-roles.properties
@@ -14,7 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-guest=guest
-Chatter1=guest
-Chatter2=guest
-Chatter3=guest
+guest=guest,Chatter1,Chatter2,Chatter3
\ No newline at end of file
diff --git a/examples/protocols/stomp/stomp-embedded-interceptor/src/main/resources/activemq/server0/artemis-roles.properties b/examples/protocols/stomp/stomp-embedded-interceptor/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/protocols/stomp/stomp-embedded-interceptor/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/examples/protocols/stomp/stomp-embedded-interceptor/src/main/resources/activemq/server0/artemis-users.properties b/examples/protocols/stomp/stomp-embedded-interceptor/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44cec4..0000000000
--- a/examples/protocols/stomp/stomp-embedded-interceptor/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java
index 4a12d9d3cf..124200266f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java
@@ -24,16 +24,15 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
-
import java.util.HashSet;
import java.util.Set;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -100,9 +99,9 @@ public class AutoCreateJmsQueueTest extends JMSTestBase {
@Test
public void testAutoCreateOnSendToQueueSecurity() throws Exception {
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addRole("guest", "rejectAll");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "rejectAll");
Role role = new Role("rejectAll", false, false, false, false, false, false, false);
Set roles = new HashSet();
roles.add(role);
@@ -184,9 +183,9 @@ public class AutoCreateJmsQueueTest extends JMSTestBase {
@Override
public void setUp() throws Exception {
super.setUp();
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addRole("guest", "allowAll");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "allowAll");
Role role = new Role("allowAll", true, true, true, true, true, true, true);
Set roles = new HashSet();
roles.add(role);
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
index 37247215a0..3ecee46c75 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
@@ -35,11 +35,12 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.filter.Filter;
-import org.apache.activemq.artemis.core.journal.RecordInfo;
import org.apache.activemq.artemis.core.io.SequentialFileFactory;
-import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory;
+import org.apache.activemq.artemis.core.journal.RecordInfo;
+import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
import org.apache.activemq.artemis.core.persistence.OperationContext;
import org.apache.activemq.artemis.core.persistence.StorageManager;
@@ -62,8 +63,9 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.ReusableLatch;
@@ -93,7 +95,7 @@ public class HangConsumerTest extends ActiveMQTestBase {
Configuration config = createDefaultInVMConfig().setMessageExpiryScanPeriod(10);
- ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
server = addServer(new MyActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager));
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java
index e5af60ef5d..256418966b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java
@@ -26,7 +26,7 @@ import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfigu
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
public class SecurityFailoverTest extends FailoverTest {
@@ -83,7 +83,7 @@ public class SecurityFailoverTest extends FailoverTest {
backupConfig = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(false)).setSecurityEnabled(true).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()).addConnectorConfiguration(liveConnector.getName(), liveConnector).addConnectorConfiguration(backupConnector.getName(), backupConnector).addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName()));
backupServer = createTestableServer(backupConfig);
- ActiveMQSecurityManagerImpl securityManager = installSecurity(backupServer);
+ ActiveMQJAASSecurityManager securityManager = installSecurity(backupServer);
securityManager.getConfiguration().setDefaultUser(null);
liveConfig = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true)).setSecurityEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName())).addConnectorConfiguration(liveConnector.getName(), liveConnector);
@@ -100,8 +100,8 @@ public class SecurityFailoverTest extends FailoverTest {
/**
* @return
*/
- protected ActiveMQSecurityManagerImpl installSecurity(TestableServer server) {
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getServer().getSecurityManager();
+ protected ActiveMQJAASSecurityManager installSecurity(TestableServer server) {
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getServer().getSecurityManager();
securityManager.getConfiguration().addUser("a", "b");
Role role = new Role("arole", true, true, true, true, true, true, true);
Set roles = new HashSet();
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
index d507ce2681..c915586622 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
@@ -38,6 +38,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.protocol.core.Packet;
import org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler;
import org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl;
@@ -52,7 +53,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
import org.junit.Before;
@@ -440,7 +441,7 @@ public class InterceptorTest extends ActiveMQTestBase {
public void testInterceptUsernameOnQueues() throws Exception {
SimpleString ANOTHER_QUEUE = QUEUE.concat("another");
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("dumb", "dumber");
securityManager.getConfiguration().addUser("an", "other");
@@ -493,9 +494,9 @@ public class InterceptorTest extends ActiveMQTestBase {
// This is testing if it's possible to intercept usernames and do some real stuff as users want
@Test
public void testInterceptUsernameOnConsumer() throws Exception {
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
- securityManager.getConfiguration().addUser("dumb", "dumber");
- securityManager.getConfiguration().addUser("an", "other");
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
+ ((SecurityConfiguration)securityManager.getConfiguration()).addUser("dumb", "dumber");
+ ((SecurityConfiguration)securityManager.getConfiguration()).addUser("an", "other");
server.getRemotingService().addIncomingInterceptor(new InterceptUserOnCreateConsumer());
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JMSSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JMSSecurityTest.java
index 1fd74df7e3..9795dce43b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JMSSecurityTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JMSSecurityTest.java
@@ -22,7 +22,7 @@ import javax.jms.JMSSecurityRuntimeException;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Before;
import org.junit.Test;
@@ -42,7 +42,7 @@ public class JMSSecurityTest extends JMSTestBase {
@Test
public void testSecurityOnJMSContext() throws Exception {
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("IDo", "Exist");
try {
JMSContext ctx = cf.createContext("Idont", "exist");
@@ -57,7 +57,7 @@ public class JMSSecurityTest extends JMSTestBase {
@Test
public void testCreateQueueConnection() throws Exception {
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("IDo", "Exist");
try {
QueueConnection queueC = ((QueueConnectionFactory) cf).createQueueConnection("IDont", "Exist");
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java
index 64f052c43a..f8b3b806c1 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java
@@ -16,25 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.jms.server;
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.core.config.FileDeploymentManager;
-import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
-import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
-import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
import javax.jms.Connection;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
@@ -44,6 +25,26 @@ import javax.jms.TextMessage;
import java.util.HashSet;
import java.util.Set;
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.config.FileDeploymentManager;
+import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.jms.server.JMSServerManager;
+import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
+import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
+import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
public class JMSServerStartStopTest extends ActiveMQTestBase {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@@ -65,7 +66,7 @@ public class JMSServerStartStopTest extends ActiveMQTestBase {
deploymentManager.addDeployable(fileConfiguration);
deploymentManager.readConfiguration();
- ActiveMQSecurityManager sm = new ActiveMQSecurityManagerImpl();
+ ActiveMQJAASSecurityManager sm = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
ActiveMQServer server = addServer(new ActiveMQServerImpl(fc, sm));
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
index 977511d24d..10cc3760d8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
@@ -16,17 +16,17 @@
*/
package org.apache.activemq.artemis.tests.integration.management;
+import java.util.Set;
+
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.junit.Test;
-import java.util.Set;
-
public class SecurityManagementWithConfiguredAdminUserTest extends SecurityManagementTestBase {
// Constants -----------------------------------------------------
@@ -81,7 +81,7 @@ public class SecurityManagementWithConfiguredAdminUserTest extends SecurityManag
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, false));
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser(validAdminUser, validAdminPassword);
securityManager.getConfiguration().addUser(invalidAdminUser, invalidAdminPassword);
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
index 19fd6cfb4d..98ee6f7d64 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java
@@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.junit.Assert;
@@ -93,7 +93,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase {
Set roles = new HashSet();
roles.add(role);
server.getSecurityRepository().addMatch(address.toString(), roles);
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addRole("guest", "roleCanNotCreateQueue");
SecurityNotificationTest.flush(notifConsumer);
@@ -133,7 +133,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase {
notifQueue = RandomUtil.randomSimpleString();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("admin", "admin");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
index 5d65894765..675574e502 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
@@ -29,9 +29,6 @@ import java.util.Set;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
-import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
-import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
-import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.apache.activemq.artemis.core.security.Role;
@@ -40,7 +37,10 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration;
import org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
+import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.After;
import org.junit.Before;
@@ -75,7 +75,7 @@ public class OpenWireTestBase extends ActiveMQTestBase {
extraServerConfig(serverConfig);
if (enableSecurity) {
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addRole("openwireSender", "sender");
securityManager.getConfiguration().addUser("openwireSender", "SeNdEr");
//sender cannot receive
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java
index 883c6a6fdb..13d15600a9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java
@@ -20,12 +20,13 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.postoffice.Binding;
import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
import org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.junit.Test;
public class ActiveMQMessageHandlerSecurityTest extends ActiveMQRATestBase {
@@ -37,6 +38,8 @@ public class ActiveMQMessageHandlerSecurityTest extends ActiveMQRATestBase {
@Test
public void testSimpleMessageReceivedOnQueueWithSecurityFails() throws Exception {
+ SecurityConfiguration emptyConfiguration = new SecurityConfiguration();
+ ((ActiveMQJAASSecurityManager)server.getSecurityManager()).setConfiguration(emptyConfiguration);
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
MyBootstrapContext ctx = new MyBootstrapContext();
qResourceAdapter.start(ctx);
@@ -61,7 +64,7 @@ public class ActiveMQMessageHandlerSecurityTest extends ActiveMQRATestBase {
@Test
public void testSimpleMessageReceivedOnQueueWithSecuritySucceeds() throws Exception {
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("testuser", "testpassword");
securityManager.getConfiguration().addRole("testuser", "arole");
Role role = new Role("arole", false, true, false, false, false, false, false);
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java
index 70c31f4bdb..0fc7416fc3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java
@@ -29,8 +29,8 @@ import org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl;
import org.apache.activemq.artemis.ra.ActiveMQRAConnectionManager;
import org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
import org.apache.activemq.artemis.service.extensions.ServiceUtils;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -51,7 +51,7 @@ public class JMSContextTest extends ActiveMQRATestBase {
public void setUp() throws Exception {
useDummyTransactionManager();
super.setUp();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("testuser", "testpassword");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java
index a1cf442d84..10723a59eb 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java
@@ -52,7 +52,7 @@ import org.apache.activemq.artemis.ra.ActiveMQRASession;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
import org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapper;
import org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.VersionLoader;
import org.junit.After;
@@ -76,7 +76,7 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase {
@Before
public void setUp() throws Exception {
super.setUp();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("testuser", "testpassword");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java
index 313f682ee6..a1abc48429 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java
@@ -28,7 +28,6 @@ import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.Session;
import javax.jms.TextMessage;
-
import java.util.HashSet;
import java.util.Set;
@@ -44,8 +43,8 @@ import org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl;
import org.apache.activemq.artemis.ra.ActiveMQRAConnectionManager;
import org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
import org.apache.activemq.artemis.service.extensions.ServiceUtils;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -67,11 +66,11 @@ public class OutgoingConnectionTestJTA extends ActiveMQRATestBase {
public void setUp() throws Exception {
useDummyTransactionManager();
super.setUp();
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addUser("testuser", "testpassword");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole");
- ((ActiveMQSecurityManagerImpl) server.getSecurityManager()).getConfiguration().addRole("guest", "arole");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("testuser", "testpassword");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole");
+ ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole");
Role role = new Role("arole", true, true, true, true, true, true, true);
Set roles = new HashSet();
roles.add(role);
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java
index f5aeec560a..e37414e153 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java
@@ -335,8 +335,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit {
}
private ActiveMQServer getActiveMQServer() {
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("LDAPLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("LDAPLogin");
Configuration configuration = new ConfigurationImpl().setSecurityEnabled(true).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()))
.setJournalDirectory(ActiveMQTestBase.getJournalDir(testDir, 0, false))
.setBindingsDirectory(ActiveMQTestBase.getBindingsDir(testDir, 0, false))
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java
index 89de0e9c02..48f98bba82 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java
@@ -300,8 +300,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit {
.setAuthentication("simple")
.populateSecurityRoles();
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("LDAPLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("LDAPLogin");
Configuration configuration = new ConfigurationImpl()
.setSecurityEnabled(true)
.addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()))
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java
index 915e3afdac..3047038176 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java
@@ -52,7 +52,6 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager2;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.CreateMessage;
import org.junit.Assert;
@@ -93,8 +92,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testJAASSecurityManagerAuthentication() throws Exception {
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("PropertiesLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
@@ -111,8 +109,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testJAASSecurityManagerAuthenticationWithCerts() throws Exception {
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("CertLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Map params = new HashMap();
@@ -148,8 +145,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testJAASSecurityManagerAuthenticationBadPassword() throws Exception {
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("PropertiesLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
@@ -173,8 +169,7 @@ public class SecurityTest extends ActiveMQTestBase {
*/
@Test
public void testJAASSecurityManagerAuthenticationWithBadClientCert() throws Exception {
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("CertLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Map params = new HashMap();
@@ -209,8 +204,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testJAASSecurityManagerAuthenticationGuest() throws Exception {
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("GuestLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("GuestLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
@@ -231,8 +225,7 @@ public class SecurityTest extends ActiveMQTestBase {
final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue");
final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue");
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("PropertiesLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Set roles = new HashSet<>();
roles.add(new Role("programmers", false, false, false, false, false, false, false));
@@ -316,8 +309,7 @@ public class SecurityTest extends ActiveMQTestBase {
final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue");
final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue");
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("CertLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Map params = new HashMap();
@@ -422,8 +414,7 @@ public class SecurityTest extends ActiveMQTestBase {
final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue");
final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue");
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("PropertiesLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Set roles = new HashSet<>();
roles.add(new Role("programmers", true, true, true, true, true, true, true));
@@ -500,8 +491,7 @@ public class SecurityTest extends ActiveMQTestBase {
final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue");
final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue");
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("CertLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Map params = new HashMap();
@@ -596,8 +586,7 @@ public class SecurityTest extends ActiveMQTestBase {
final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue");
final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue");
- ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager();
- securityManager.setConfigurationName("GuestLogin");
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("GuestLogin");
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
Set roles = new HashSet<>();
roles.add(new Role("bar", true, true, true, true, true, true, true));
@@ -672,7 +661,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testCreateSessionWithNullUserPass() throws Exception {
ActiveMQServer server = createServer();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
server.start();
@@ -718,7 +707,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testCreateSessionWithCorrectUserWrongPass() throws Exception {
ActiveMQServer server = createServer();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("newuser", "apass");
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
@@ -738,7 +727,7 @@ public class SecurityTest extends ActiveMQTestBase {
@Test
public void testCreateSessionWithCorrectUserCorrectPass() throws Exception {
ActiveMQServer server = createServer();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("newuser", "apass");
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
@@ -758,7 +747,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false);
Set roles = new HashSet();
@@ -777,7 +766,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, false, false, false);
Set roles = new HashSet();
@@ -804,7 +793,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, true, false, false, false);
Set roles = new HashSet();
@@ -823,7 +812,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false);
Set roles = new HashSet();
@@ -852,7 +841,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, false, false);
Set roles = new HashSet();
@@ -871,7 +860,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, false, false, false);
Set roles = new HashSet();
@@ -898,7 +887,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, true, false);
Set roles = new HashSet();
@@ -917,7 +906,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, false, false);
Set roles = new HashSet();
@@ -948,7 +937,7 @@ public class SecurityTest extends ActiveMQTestBase {
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
@@ -1010,7 +999,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false);
Set roles = new HashSet();
@@ -1040,7 +1029,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false);
Set roles = new HashSet();
@@ -1063,7 +1052,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().addRole("guest", "guest");
@@ -1091,7 +1080,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().addRole("guest", "guest");
@@ -1128,7 +1117,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer(false, configuration);
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().addRole("guest", "guest");
@@ -1179,7 +1168,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().addRole("guest", "guest");
@@ -1239,7 +1228,7 @@ public class SecurityTest extends ActiveMQTestBase {
ActiveMQServer server = createServer(false, configuration);
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().addRole("guest", "guest");
@@ -1331,7 +1320,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, false, false, true);
Set roles = new HashSet();
@@ -1352,7 +1341,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false);
Set roles = new HashSet();
@@ -1383,7 +1372,7 @@ public class SecurityTest extends ActiveMQTestBase {
server.start();
HierarchicalRepository> securityRepository = server.getSecurityRepository();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false);
Set roles = new HashSet();
@@ -1406,7 +1395,7 @@ public class SecurityTest extends ActiveMQTestBase {
public void testComplexRoles() throws Exception {
ActiveMQServer server = createServer();
server.start();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("all", "all");
securityManager.getConfiguration().addUser("bill", "activemq");
securityManager.getConfiguration().addUser("andrew", "activemq1");
@@ -1537,7 +1526,7 @@ public class SecurityTest extends ActiveMQTestBase {
public void _testComplexRoles2() throws Exception {
ActiveMQServer server = createServer();
server.start();
- ActiveMQSecurityManagerImpl securityManager = (ActiveMQSecurityManagerImpl) server.getSecurityManager();
+ ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("all", "all");
securityManager.getConfiguration().addUser("bill", "activemq");
securityManager.getConfiguration().addUser("andrew", "activemq1");
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
index 67f744a1b0..165b332ed7 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
@@ -37,6 +37,7 @@ import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
import org.apache.activemq.artemis.api.jms.management.TopicControl;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.security.Role;
@@ -45,7 +46,8 @@ import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.jms.server.JMSServerManager;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.jms.tests.JmsTestLogger;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
public class LocalTestServer implements Server, Runnable {
// Constants ------------------------------------------------------------------------------------
@@ -101,7 +103,7 @@ public class LocalTestServer implements Server, Runnable {
javax.management.MBeanServer beanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer();
FileConfiguration fileConfiguration = new FileConfiguration();
- ActiveMQSecurityManagerImpl securityManager = new ActiveMQSecurityManagerImpl();
+ ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
securityManager.getConfiguration().addRole("guest", "guest");