mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-24 17:47:46 +01:00
Update the registry client to support pulling public images from docker hub without login
Only add the authentication info when the username is provided to support pulling public images from docker hub without login Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
df2ae63308
commit
74efee569e
@ -38,7 +38,12 @@ func NewBasicAuthCredential(username, password string) Credential {
|
||||
}
|
||||
|
||||
func (b *basicAuthCredential) AddAuthorization(req *http.Request) {
|
||||
req.SetBasicAuth(b.username, b.password)
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
// implement github.com/goharbor/harbor/src/common/http/modifier.Modifier
|
||||
|
Loading…
Reference in New Issue
Block a user