You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2022/10/19 09:39:58 UTC
[activemq-artemis] branch main updated: ARTEMIS-4049 user add fails w/space in broker path
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 9138cc86ca ARTEMIS-4049 user add fails w/space in broker path
new 75ce36cdbe This closes #4259
9138cc86ca is described below
commit 9138cc86ca30f295c554d356fedc956308ab8a2c
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Mon Oct 17 12:56:02 2022 -0500
ARTEMIS-4049 user add fails w/space in broker path
This problem was originally discovered on Windows, but the problem
occurs on *nix as well.
---
.../org/apache/activemq/cli/test/ArtemisTest.java | 19 +++++++++++++++++++
.../management/impl/ActiveMQServerControlImpl.java | 8 +++++---
2 files changed, 24 insertions(+), 3 deletions(-)
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 e37952a735..a136e27048 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
@@ -1418,6 +1418,25 @@ public class ArtemisTest extends CliTestBase {
// Checking it was acked before
assertEquals(Integer.valueOf(100), Artemis.internalExecute("consumer", "--destination", "queue://q1", "--txt-size", "50", "--break-on-null", "--receive-timeout", "100", "--user", "admin", "--password", "admin"));
+
+ //add a simple user
+ AddUser addCmd = new AddUser();
+ addCmd.setUserCommandUser("guest");
+ addCmd.setUserCommandPassword("guest123");
+ addCmd.setRole("admin");
+ addCmd.setUser("admin");
+ addCmd.setPassword("admin");
+ addCmd.execute(new TestActionContext());
+
+ //verify use list cmd
+ TestActionContext context = new TestActionContext();
+ ListUser listCmd = new ListUser();
+ listCmd.setUser("admin");
+ listCmd.setPassword("admin");
+ listCmd.execute(context);
+ String result = context.getStdout();
+
+ assertTrue(result.contains("\"guest\"(admin)"));
} finally {
stopServer();
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index d7edd431c0..2b541583ec 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -26,7 +26,10 @@ import javax.management.NotificationEmitter;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.transaction.xa.Xid;
+import java.io.File;
+import java.lang.invoke.MethodHandles;
import java.net.URL;
+import java.nio.file.Path;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -145,7 +148,6 @@ import org.apache.activemq.artemis.utils.SecurityFormatter;
import org.apache.activemq.artemis.utils.collections.TypedProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.lang.invoke.MethodHandles;
public class ActiveMQServerControlImpl extends AbstractControl implements ActiveMQServerControl, NotificationEmitter, org.apache.activemq.artemis.core.server.management.NotificationListener {
@@ -4535,8 +4537,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
if (configurationUrl == null) {
throw ActiveMQMessageBundle.BUNDLE.failedToLocateConfigURL();
}
- String path = configurationUrl.getPath();
- return new PropertiesLoginModuleConfigurator(getSecurityDomain(), path.substring(0, path.lastIndexOf("/")));
+ String path = Path.of(configurationUrl.toURI()).toString();
+ return new PropertiesLoginModuleConfigurator(getSecurityDomain(), path.substring(0, path.lastIndexOf(File.separator)));
}
@Override