activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/5] activemq-artemis git commit: ARTEMIS-133 adding property to force security on the CLI
Date Thu, 04 Jun 2015 18:40:28 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master a4a3a4070 -> 2c1a7cbcb


ARTEMIS-133 adding property to force security on the CLI

https://issues.apache.org/jira/browse/ARTEMIS-133

This is just adding a property so it would be


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/8edcf7c5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/8edcf7c5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/8edcf7c5

Branch: refs/heads/master
Commit: 8edcf7c5b214b44ed81dd78eb8caccb04e104310
Parents: a4a3a40
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Thu Jun 4 10:04:43 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Jun 4 10:26:44 2015 -0400

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/Create.java   | 25 +++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8edcf7c5/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
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 5a2f252..a1178a5 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
@@ -127,6 +127,9 @@ public class Create extends InputAbstract
    @Option(name = "--allow-anonymous", description = "Enables anonymous configuration on
security (Default: input)")
    Boolean allowAnonymous = null;
 
+   @Option(name = "--require-login", description = "This will configure security to require
user / password. Compliment --allow-anonymous")
+   Boolean requireLogin = null;
+
    @Option(name = "--user", description = "The username (Default: input)")
    String user;
 
@@ -323,7 +326,7 @@ public class Create extends InputAbstract
    {
       if (allowAnonymous == null)
       {
-         String value = input("--allow-anonymous", "Allow anonymous access? (Y/N):", "Y");
+         String value = input("--allow-anonymous | --require-login", "Allow anonymous access?
(Y/N):", "Y");
          allowAnonymous = Boolean.valueOf(value.toLowerCase().equals("y"));
       }
       return allowAnonymous.booleanValue();
@@ -334,6 +337,20 @@ public class Create extends InputAbstract
       this.allowAnonymous = Boolean.valueOf(allowGuest);
    }
 
+   public Boolean getRequireLogin()
+   {
+      if (requireLogin == null)
+      {
+         requireLogin = !isAllowAnonymous();
+      }
+      return requireLogin;
+   }
+
+   public void setRequireLogin(Boolean requireLogin)
+   {
+      this.requireLogin = requireLogin;
+   }
+
    public String getPassword()
    {
 
@@ -407,6 +424,12 @@ public class Create extends InputAbstract
       IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win");
       IS_CYGWIN = IS_WINDOWS && "cygwin".equals(System.getenv("OSTYPE"));
 
+      // requireLogin should set alloAnonymous=false, to avoid user's questions
+      if (requireLogin != null && requireLogin.booleanValue())
+      {
+         allowAnonymous = Boolean.FALSE;
+      }
+
       context.out.println(String.format("Creating ActiveMQ Artemis instance at: %s", directory.getCanonicalPath()));
 
       HashMap<String, String> filters = new HashMap<String, String>();


Mime
View raw message