Skip to content

Commit de11815

Browse files
authored
fix: get rid of deprecated types.AuthConfig (#678)
`types.AuthConfig` removed in github.com/docker/docker@v25, can't update to it Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
1 parent 7801c2c commit de11815

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/auth/docker/login.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"context"
2020

2121
ctypes "github.com/docker/cli/cli/config/types"
22-
"github.com/docker/docker/api/types"
22+
apiregistry "github.com/docker/docker/api/types/registry"
2323
"github.com/docker/docker/registry"
2424

2525
iface "oras.land/oras-go/pkg/auth"
@@ -51,7 +51,7 @@ func (c *Client) LoginWithOpts(options ...iface.LoginOption) error {
5151

5252
func (c *Client) login(settings *iface.LoginSettings) error {
5353
hostname := resolveHostname(settings.Hostname)
54-
cred := types.AuthConfig{
54+
cred := apiregistry.AuthConfig{
5555
Username: settings.Username,
5656
ServerAddress: hostname,
5757
}

pkg/auth/docker/login_tls.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/docker/distribution/registry/api/errcode"
2929
"github.com/docker/distribution/registry/client/auth"
3030
"github.com/docker/distribution/registry/client/transport"
31-
"github.com/docker/docker/api/types"
31+
apiregistry "github.com/docker/docker/api/types/registry"
3232
"github.com/docker/docker/errdefs"
3333
"github.com/docker/docker/registry"
3434
"github.com/docker/go-connections/tlsconfig"
@@ -41,7 +41,7 @@ import (
4141
// They are not exposed in the docker/registry package that's why they are copied here
4242

4343
type loginCredentialStore struct {
44-
authConfig *types.AuthConfig
44+
authConfig *apiregistry.AuthConfig
4545
}
4646

4747
func (lcs loginCredentialStore) Basic(*url.URL) (string, string) {
@@ -59,7 +59,7 @@ func (lcs loginCredentialStore) SetRefreshToken(u *url.URL, service, token strin
5959
// loginWithTLS tries to login to the v2 registry server.
6060
// A custom tls.Config is used to override the default TLS configuration of the different registry endpoints.
6161
// The tls.Config is created using the provided certificate, certificate key and certificate authority.
62-
func (c *Client) loginWithTLS(ctx context.Context, service *registry.Service, certFile, keyFile, caFile string, authConfig *types.AuthConfig, userAgent string) (string, string, error) {
62+
func (c *Client) loginWithTLS(ctx context.Context, service *registry.Service, certFile, keyFile, caFile string, authConfig *apiregistry.AuthConfig, userAgent string) (string, string, error) {
6363
tlsConfig, err := tlsconfig.Client(tlsconfig.Options{CAFile: caFile, CertFile: certFile, KeyFile: keyFile})
6464
if err != nil {
6565
return "", "", err
@@ -119,7 +119,7 @@ func (c *Client) getEndpoints(address string, service *registry.Service) ([]regi
119119
// loginV2 tries to login to the v2 registry server. The given registry
120120
// endpoint will be pinged to get authorization challenges. These challenges
121121
// will be used to authenticate against the registry to validate credentials.
122-
func loginV2(authConfig *types.AuthConfig, endpoint registry.APIEndpoint, userAgent string) (string, string, error) {
122+
func loginV2(authConfig *apiregistry.AuthConfig, endpoint registry.APIEndpoint, userAgent string) (string, string, error) {
123123
var (
124124
endpointStr = strings.TrimRight(endpoint.URL.String(), "/") + "/v2/"
125125
modifiers = registry.Headers(userAgent, nil)

0 commit comments

Comments
 (0)