Github user Graeme-Miller commented on a diff in the pull request: https://github.com/apache/brooklyn-client/pull/42#discussion_r118458597 --- Diff: cli/io/config.go --- @@ -70,3 +98,111 @@ func (config *Config) Read() { dec := json.NewDecoder(fileToRead) dec.Decode(&config.Map) } + + +// getCredentials reads credentials from .brooklyn_cli data formatted for versions > 0.11.0 +// Note that the password is base64 encoded to avoid json formatting problems +//{ +// "credentials": { +// "password": "cGFzc3dvcmQ=", +// "username": "geoff" +// }, +// "skipSslChecks": false, +// "target": "http://geoffs-macbook-pro.local:8081" +//} +func (config *Config) getCredentials(target string) (username string, password string, err error) { + credentials, found := config.Map[credentialsKey].(string) + if !found { + err = errors.New("No credentials found for " + target) + return + } + + if decoded, errd := base64.StdEncoding.DecodeString(credentials); errd != nil { + err = errors.New("Could not decode credentials for " + target) + return + } else { + userAndPassword := strings.SplitN(string(decoded), ":", 2) + if len(userAndPassword) != 2 { --- End diff -- It is possible for a brooklyn user to have a ':' in there password. If that is the case then they will not be able to use the BR command as we will fail at this line. I suggest encoding/decoding username and password separately
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---