Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32B531855C for ; Thu, 4 Jun 2015 18:40:29 +0000 (UTC) Received: (qmail 2377 invoked by uid 500); 4 Jun 2015 18:40:29 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 2230 invoked by uid 500); 4 Jun 2015 18:40:29 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 2085 invoked by uid 99); 4 Jun 2015 18:40:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2015 18:40:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C0A2EE109B; Thu, 4 Jun 2015 18:40:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbertram@apache.org To: commits@activemq.apache.org Date: Thu, 04 Jun 2015 18:40:28 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/5] activemq-artemis git commit: ARTEMIS-133 adding property to force security on the CLI 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 Authored: Thu Jun 4 10:04:43 2015 -0400 Committer: Clebert Suconic 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 filters = new HashMap();