Return no basic auth creds error when needed
If the auth config contains an empty username/password we should return an error Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
This commit is contained in:
parent
adea457841
commit
8777592397
1 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/containerd/containerd/remotes/docker"
|
||||
"github.com/containerd/containerd/version"
|
||||
"github.com/containerd/log"
|
||||
"github.com/docker/distribution/registry/client/auth"
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/pkg/useragent"
|
||||
|
@ -75,11 +76,15 @@ func authorizerFromAuthConfig(authConfig registrytypes.AuthConfig) docker.Author
|
|||
"host": host,
|
||||
"cfgHost": cfgHost,
|
||||
}).Warn("Host doesn't match")
|
||||
return "", "", nil
|
||||
return "", "", auth.ErrNoBasicAuthCredentials
|
||||
}
|
||||
if authConfig.IdentityToken != "" {
|
||||
return "", authConfig.IdentityToken, nil
|
||||
}
|
||||
|
||||
if authConfig.Username == "" && authConfig.Password == "" {
|
||||
return "", "", auth.ErrNoBasicAuthCredentials
|
||||
}
|
||||
return authConfig.Username, authConfig.Password, nil
|
||||
}))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue