@@ -3,6 +3,7 @@ package client
3
3
import (
4
4
"net"
5
5
"net/http"
6
+ "net/url"
6
7
"time"
7
8
8
9
"github.com/distribution/reference"
@@ -97,7 +98,7 @@ func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.API
97
98
if len (actions ) == 0 {
98
99
actions = []string {"pull" }
99
100
}
100
- creds := registry . NewStaticCredentialStore ( & authConfig )
101
+ creds := & staticCredentialStore { authConfig : & authConfig }
101
102
tokenHandler := auth .NewTokenHandler (authTransport , creds , repoName , actions ... )
102
103
basicHandler := auth .NewBasicHandler (creds )
103
104
modifiers = append (modifiers , auth .NewAuthorizer (challengeManager , tokenHandler , basicHandler ))
@@ -117,3 +118,23 @@ func (th *existingTokenHandler) AuthorizeRequest(req *http.Request, _ map[string
117
118
func (* existingTokenHandler ) Scheme () string {
118
119
return "bearer"
119
120
}
121
+
122
+ type staticCredentialStore struct {
123
+ authConfig * registrytypes.AuthConfig
124
+ }
125
+
126
+ func (scs staticCredentialStore ) Basic (* url.URL ) (string , string ) {
127
+ if scs .authConfig == nil {
128
+ return "" , ""
129
+ }
130
+ return scs .authConfig .Username , scs .authConfig .Password
131
+ }
132
+
133
+ func (scs staticCredentialStore ) RefreshToken (* url.URL , string ) string {
134
+ if scs .authConfig == nil {
135
+ return ""
136
+ }
137
+ return scs .authConfig .IdentityToken
138
+ }
139
+
140
+ func (staticCredentialStore ) SetRefreshToken (* url.URL , string , string ) {}
0 commit comments