From 8fc5eda7c4fd79f8d8d76678e90185cdb028d2fa Mon Sep 17 00:00:00 2001 From: David Calavera Date: Mon, 29 Feb 2016 17:03:52 -0500 Subject: [PATCH] Set default credentials store in Windows. Use the Windows Credentials Manager when the helper is installed in the path. Signed-off-by: David Calavera Upstream-commit: 056c27d895e6e0c416d8d4253e99f4b211a1fb4f Component: engine --- .../cliconfig/credentials/default_store.go | 22 +++++++++++++++++++ .../credentials/default_store_darwin.go | 19 ---------------- .../credentials/default_store_unix.go | 5 +++++ .../credentials/default_store_unsupported.go | 11 ---------- .../credentials/default_store_windows.go | 3 +++ 5 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 components/engine/cliconfig/credentials/default_store.go create mode 100644 components/engine/cliconfig/credentials/default_store_unix.go delete mode 100644 components/engine/cliconfig/credentials/default_store_unsupported.go create mode 100644 components/engine/cliconfig/credentials/default_store_windows.go diff --git a/components/engine/cliconfig/credentials/default_store.go b/components/engine/cliconfig/credentials/default_store.go new file mode 100644 index 0000000000..b5fc47ccb3 --- /dev/null +++ b/components/engine/cliconfig/credentials/default_store.go @@ -0,0 +1,22 @@ +package credentials + +import ( + "os/exec" + + "github.com/docker/docker/cliconfig" +) + +// DetectDefaultStore sets the default credentials store +// if the host includes the default store helper program. +func DetectDefaultStore(c *cliconfig.ConfigFile) { + if c.CredentialsStore != "" { + // user defined + return + } + + if defaultCredentialsStore != "" { + if _, err := exec.LookPath(remoteCredentialsPrefix + defaultCredentialsStore); err == nil { + c.CredentialsStore = defaultCredentialsStore + } + } +} diff --git a/components/engine/cliconfig/credentials/default_store_darwin.go b/components/engine/cliconfig/credentials/default_store_darwin.go index ad76187f6e..63e8ed4010 100644 --- a/components/engine/cliconfig/credentials/default_store_darwin.go +++ b/components/engine/cliconfig/credentials/default_store_darwin.go @@ -1,22 +1,3 @@ package credentials -import ( - "os/exec" - - "github.com/docker/docker/cliconfig" -) - const defaultCredentialsStore = "osxkeychain" - -// DetectDefaultStore sets the default credentials store -// if the host includes the default store helper program. -func DetectDefaultStore(c *cliconfig.ConfigFile) { - if c.CredentialsStore != "" { - // user defined - return - } - - if _, err := exec.LookPath(remoteCredentialsPrefix + c.CredentialsStore); err == nil { - c.CredentialsStore = defaultCredentialsStore - } -} diff --git a/components/engine/cliconfig/credentials/default_store_unix.go b/components/engine/cliconfig/credentials/default_store_unix.go new file mode 100644 index 0000000000..cdb909a6bc --- /dev/null +++ b/components/engine/cliconfig/credentials/default_store_unix.go @@ -0,0 +1,5 @@ +// +build !windows,!darwin + +package credentials + +const defaultCredentialsStore = "" diff --git a/components/engine/cliconfig/credentials/default_store_unsupported.go b/components/engine/cliconfig/credentials/default_store_unsupported.go deleted file mode 100644 index 724d598865..0000000000 --- a/components/engine/cliconfig/credentials/default_store_unsupported.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !darwin - -package credentials - -import "github.com/docker/docker/cliconfig" - -// DetectDefaultStore sets the default credentials store -// if the host includes the default store helper program. -// This operation is only supported in Darwin. -func DetectDefaultStore(c *cliconfig.ConfigFile) { -} diff --git a/components/engine/cliconfig/credentials/default_store_windows.go b/components/engine/cliconfig/credentials/default_store_windows.go new file mode 100644 index 0000000000..fb6a9745cf --- /dev/null +++ b/components/engine/cliconfig/credentials/default_store_windows.go @@ -0,0 +1,3 @@ +package credentials + +const defaultCredentialsStore = "wincred"