diff --git a/registry/proxy/proxyauth.go b/registry/proxy/proxyauth.go index bdc5fee8e1e..adf60cb9c3f 100644 --- a/registry/proxy/proxyauth.go +++ b/registry/proxy/proxyauth.go @@ -12,24 +12,24 @@ import ( const challengeHeader = "Docker-Distribution-Api-Version" -type basicAuth struct { +type userpass struct { username string password string } -func (b basicAuth) Basic(u *url.URL) (string, string) { - return b.username, b.password +func (u userpass) Basic(_ *url.URL) (string, string) { + return u.username, u.password } -func (b basicAuth) RefreshToken(u *url.URL, service string) string { +func (u userpass) RefreshToken(_ *url.URL, service string) string { return "" } -func (b basicAuth) SetRefreshToken(u *url.URL, service, token string) { +func (u userpass) SetRefreshToken(_ *url.URL, service, token string) { } type credentials struct { - creds map[string]basicAuth + creds map[string]userpass } func (c credentials) Basic(u *url.URL) (string, string) { @@ -45,7 +45,7 @@ func (c credentials) SetRefreshToken(u *url.URL, service, token string) { // configureAuth stores credentials for challenge responses func configureAuth(username, password, remoteURL string) (auth.CredentialStore, auth.CredentialStore, error) { - creds := map[string]basicAuth{} + creds := map[string]userpass{} authURLs, err := getAuthURLs(remoteURL) if err != nil { @@ -54,13 +54,13 @@ func configureAuth(username, password, remoteURL string) (auth.CredentialStore, for _, url := range authURLs { dcontext.GetLogger(dcontext.Background()).Infof("Discovered token authentication URL: %s", url) - creds[url] = basicAuth{ + creds[url] = userpass{ username: username, password: password, } } - return credentials{creds: creds}, basicAuth{username: username, password: password}, nil + return credentials{creds: creds}, userpass{username: username, password: password}, nil } func getAuthURLs(remoteURL string) ([]string, error) {