(endpoint *url.URL, authTransport http.RoundTripper, modifiers []transport.RequestModifier, creds auth.CredentialStore, scopes []auth.Scope)
| 74 | } |
| 75 | |
| 76 | func 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. |
no test coverage detected
searching dependent graphs…