MCPcopy Create free account
hub / github.com/docker/cli / v2AuthHTTPClient

Function v2AuthHTTPClient

internal/registry/auth.go:76–99  ·  view source on GitHub ↗
(endpoint *url.URL, authTransport http.RoundTripper, modifiers []transport.RequestModifier, creds auth.CredentialStore, scopes []auth.Scope)

Source from the content-addressed store, hash-verified

74}
75
76func v2AuthHTTPClient(endpoint *url.URL, authTransport http.RoundTripper, modifiers []transport.RequestModifier, creds auth.CredentialStore, scopes []auth.Scope) (*http.Client, error) {
77 challengeManager, err := PingV2Registry(endpoint, authTransport)
78 if err != nil {
79 return nil, err
80 }
81
82 authHandlers := []auth.AuthenticationHandler{
83 auth.NewTokenHandlerWithOptions(auth.TokenHandlerOptions{
84 Transport: authTransport,
85 Credentials: creds,
86 OfflineAccess: true,
87 ClientID: AuthClientID,
88 Scopes: scopes,
89 }),
90 auth.NewBasicHandler(creds),
91 }
92
93 modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, authHandlers...))
94
95 return &http.Client{
96 Transport: transport.NewTransport(authTransport, modifiers...),
97 Timeout: 15 * time.Second,
98 }, nil
99}
100
101// PingV2Registry attempts to ping a v2 registry and on success return a
102// challenge manager for the supported authentication types.

Callers 1

loginV2Function · 0.85

Calls 1

PingV2RegistryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…