Set default credentials store in Windows.
Use the Windows Credentials Manager when the helper is installed in the path. Signed-off-by: David Calavera <david.calavera@gmail.com> Upstream-commit: 056c27d895e6e0c416d8d4253e99f4b211a1fb4f Component: engine
This commit is contained in:
22
components/engine/cliconfig/credentials/default_store.go
Normal file
22
components/engine/cliconfig/credentials/default_store.go
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
// +build !windows,!darwin
|
||||
|
||||
package credentials
|
||||
|
||||
const defaultCredentialsStore = ""
|
||||
@ -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) {
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
package credentials
|
||||
|
||||
const defaultCredentialsStore = "wincred"
|
||||
Reference in New Issue
Block a user