diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-11 05:39:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 05:39:12 -0800 |
commit | b3eb23d671425775673f86bd02b9c89ef781f590 (patch) | |
tree | 5f06e4e289f16d9164d692590a3fe6541b5384cf /vendor/github.com/fsouza/go-dockerclient/auth.go | |
parent | 26f2b7debde313af4a5ae39727c66a3f8fd59be4 (diff) | |
parent | bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87 (diff) | |
download | podman-b3eb23d671425775673f86bd02b9c89ef781f590.tar.gz podman-b3eb23d671425775673f86bd02b9c89ef781f590.tar.bz2 podman-b3eb23d671425775673f86bd02b9c89ef781f590.zip |
Merge pull request #2102 from vrothberg/vendor-update
vendor: update everything
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/auth.go')
-rw-r--r-- | vendor/github.com/fsouza/go-dockerclient/auth.go | 24 |
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 } |