summaryrefslogtreecommitdiff
path: root/vendor/github.com/fsouza/go-dockerclient/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/auth.go')
-rw-r--r--vendor/github.com/fsouza/go-dockerclient/auth.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/auth.go b/vendor/github.com/fsouza/go-dockerclient/auth.go
index c58de8671..acb3a02be 100644
--- a/vendor/github.com/fsouza/go-dockerclient/auth.go
+++ b/vendor/github.com/fsouza/go-dockerclient/auth.go
@@ -27,6 +27,11 @@ type AuthConfiguration struct {
Password string `json:"password,omitempty"`
Email string `json:"email,omitempty"`
ServerAddress string `json:"serveraddress,omitempty"`
+
+ // IdentityToken can be supplied with the identitytoken response of the AuthCheck call
+ // see https://godoc.org/github.com/docker/docker/api/types#AuthConfig
+ // It can be used in place of password not in conjunction with it
+ IdentityToken string `json:"identitytoken,omitempty"`
}
// AuthConfigurations represents authentication options to use for the
@@ -42,8 +47,9 @@ type AuthConfigurations119 map[string]AuthConfiguration
// dockerConfig represents a registry authentation configuration from the
// .dockercfg file.
type dockerConfig struct {
- Auth string `json:"auth"`
- Email string `json:"email"`
+ Auth string `json:"auth"`
+ Email string `json:"email"`
+ IdentityToken string `json:"identitytoken"`
}
// NewAuthConfigurationsFromFile returns AuthConfigurations from a path containing JSON
@@ -128,6 +134,7 @@ func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) {
c := &AuthConfigurations{
Configs: make(map[string]AuthConfiguration),
}
+
for reg, conf := range confs {
if conf.Auth == "" {
continue
@@ -136,17 +143,28 @@ func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) {
if err != nil {
return nil, err
}
+
userpass := strings.SplitN(string(data), ":", 2)
if len(userpass) != 2 {
return nil, ErrCannotParseDockercfg
}
- c.Configs[reg] = AuthConfiguration{
+
+ authConfig := AuthConfiguration{
Email: conf.Email,
Username: userpass[0],
Password: userpass[1],
ServerAddress: reg,
}
+
+ // if identitytoken provided then zero the password and set it
+ if conf.IdentityToken != "" {
+ authConfig.Password = ""
+ authConfig.IdentityToken = conf.IdentityToken
+ }
+
+ c.Configs[reg] = authConfig
}
+
return c, nil
}