|
@@ -30,7 +30,7 @@ func (dcs dumbCredentialStore) Basic(*url.URL) (string, string) {
|
|
|
// NewV2Repository returns a repository (v2 only). It creates a HTTP transport
|
|
|
// providing timeout settings and authentication support, and also verifies the
|
|
|
// remote API version.
|
|
|
-func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, metaHeaders http.Header, authConfig *cliconfig.AuthConfig) (distribution.Repository, error) {
|
|
|
+func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, metaHeaders http.Header, authConfig *cliconfig.AuthConfig, actions ...string) (distribution.Repository, error) {
|
|
|
ctx := context.Background()
|
|
|
|
|
|
repoName := repoInfo.CanonicalName
|
|
@@ -91,7 +91,7 @@ func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEnd
|
|
|
}
|
|
|
|
|
|
creds := dumbCredentialStore{auth: authConfig}
|
|
|
- tokenHandler := auth.NewTokenHandler(authTransport, creds, repoName, "push", "pull")
|
|
|
+ tokenHandler := auth.NewTokenHandler(authTransport, creds, repoName, actions...)
|
|
|
basicHandler := auth.NewBasicHandler(creds)
|
|
|
modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler))
|
|
|
tr := transport.NewTransport(base, modifiers...)
|