Merge pull request #46631 from rumpl/c8d-no-basic-auth
Return no basic auth creds error when needed
This commit is contained in:
commit
6c1c76d02a
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…
Reference in a new issue