Skip to content

Commit

Permalink
Revert renaming userpass
Browse files Browse the repository at this point in the history
Signed-off-by: oliver-goetz <o.goetz@sap.com>
  • Loading branch information
oliver-goetz committed Feb 5, 2024
1 parent 800a567 commit f5b476d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions registry/proxy/proxyauth.go
Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -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) {
Expand Down

0 comments on commit f5b476d

Please sign in to comment.