mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-05 10:10:12 +01:00
Merge pull request #7269 from ywk253100/190401_registry_client
Update the registry client to support pulling public images from docker hub without login
This commit is contained in:
commit
1513c37ac2
@ -38,7 +38,12 @@ func NewBasicAuthCredential(username, password string) Credential {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *basicAuthCredential) AddAuthorization(req *http.Request) {
|
func (b *basicAuthCredential) AddAuthorization(req *http.Request) {
|
||||||
|
// only add the authentication info when the username isn't empty
|
||||||
|
// the logic is needed for requesting resources from docker hub's
|
||||||
|
// public repositories
|
||||||
|
if len(b.username) > 0 {
|
||||||
req.SetBasicAuth(b.username, b.password)
|
req.SetBasicAuth(b.username, b.password)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// implement github.com/goharbor/harbor/src/common/http/modifier.Modifier
|
// implement github.com/goharbor/harbor/src/common/http/modifier.Modifier
|
||||||
|
Loading…
Reference in New Issue
Block a user