Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/112#discussion_r15986075
  
    --- Diff: usage/cli/src/main/java/brooklyn/cli/Main.java ---
    @@ -200,6 +203,57 @@ public Void call() throws Exception {
             }
         }
     
    +    @Command(name = "generate-password", description = "Generates a hashed 
web-console password")
    +    public static class GeneratePasswordCommand extends 
BrooklynCommandCollectingArgs {
    +
    +        @Option(name = { "--user" }, title = "username", required = true)
    +        public String user;
    +
    +        @Override
    +        public Void call() throws Exception {
    +            System.out.println(BANNER);
    +            System.out.println("Version:  " + BrooklynVersion.get());
    +            System.out.println("Website:  
http://brooklyn.incubator.apache.org";);
    +            System.out.println("Source:   
https://github.com/apache/incubator-brooklyn";);
    +            System.out.println();
    +            System.out.println("Copyright 2011-2014 The Apache Software 
Foundation.");
    +            System.out.println("Licensed under the Apache 2.0 License");
    +            System.out.println();
    +            
    +            Console console = System.console();
    +            if (console == null) {
    +                System.err.println("No console; cannot get password 
securely from standard input; aborting");
    +            }
    +            System.out.print("Enter password: ");
    +            System.out.flush();
    +            char[] chars = console.readPassword();
    +            if (Strings.isBlank(new String(chars))) {
    +                System.err.println("Password must not be blank; aborting");
    +                return null;
    +            }
    +            
    +            System.out.print("Re-enter password: ");
    +            System.out.flush();
    +            char[] chars2 = console.readPassword();
    +            if (!Arrays.equals(chars, chars2)) {
    +                System.err.println("Passwords did not match; aborting");
    +                return null;
    +            }
    +
    +            String salt = Identifiers.makeRandomId(4);
    +            String sha256password = PasswordHasher.sha256(salt, new 
String(chars));
    +            
    +            System.out.println();
    +            System.out.println("Please enter the following into your 
brooklyn.properies:");
    --- End diff --
    
    Would prefer the line to be phrased "Please add the following to your 
brooklyn.properties".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to