From f0ce2f6d369a35d9b0bf3e6a31404ee3dbfdb9bb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 13 Oct 2022 23:58:24 +0200 Subject: [PATCH] remotes/docker: remove deprecated NewAuthorizer alias This was deprecated since containerd v1.3.0. Signed-off-by: Sebastiaan van Stijn --- remotes/docker/authorizer.go | 7 ------- remotes/docker/resolver_test.go | 10 +++++++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/remotes/docker/authorizer.go b/remotes/docker/authorizer.go index eaa0e5dbd..57479ef63 100644 --- a/remotes/docker/authorizer.go +++ b/remotes/docker/authorizer.go @@ -45,13 +45,6 @@ type dockerAuthorizer struct { onFetchRefreshToken OnFetchRefreshToken } -// NewAuthorizer creates a Docker authorizer using the provided function to -// get credentials for the token server or basic auth. -// Deprecated: Use NewDockerAuthorizer -func NewAuthorizer(client *http.Client, f func(string) (string, string, error)) Authorizer { - return NewDockerAuthorizer(WithAuthClient(client), WithAuthCreds(f)) -} - type authorizerConfig struct { credentials func(string) (string, string, error) client *http.Client diff --git a/remotes/docker/resolver_test.go b/remotes/docker/resolver_test.go index c1311ac0d..4719e75fb 100644 --- a/remotes/docker/resolver_test.go +++ b/remotes/docker/resolver_test.go @@ -68,11 +68,15 @@ func TestBasicResolver(t *testing.T) { }) base, options, close := tlsServer(wrapped) + authorizer := NewDockerAuthorizer( + WithAuthClient(options.Client), + WithAuthCreds(func(host string) (string, string, error) { + return "user1", "password1", nil + }), + ) options.Hosts = ConfigureDefaultRegistries( WithClient(options.Client), - WithAuthorizer(NewAuthorizer(options.Client, func(string) (string, string, error) { - return "user1", "password1", nil - })), + WithAuthorizer(authorizer), ) return base, options, close }