mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
registry: v2AuthHTTPClient: inline some vars and slight refactor
- inline the auth.TokenHandlerOptions in the auth.NewTokenHandlerWithOptions call - construct a authHandlers slice to make it more clear that this is a variadic list of authentication-handlers. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -108,16 +108,18 @@ func v2AuthHTTPClient(endpoint *url.URL, authTransport http.RoundTripper, modifi
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tokenHandlerOptions := auth.TokenHandlerOptions{
|
||||
Transport: authTransport,
|
||||
Credentials: creds,
|
||||
OfflineAccess: true,
|
||||
ClientID: AuthClientID,
|
||||
Scopes: scopes,
|
||||
authHandlers := []auth.AuthenticationHandler{
|
||||
auth.NewTokenHandlerWithOptions(auth.TokenHandlerOptions{
|
||||
Transport: authTransport,
|
||||
Credentials: creds,
|
||||
OfflineAccess: true,
|
||||
ClientID: AuthClientID,
|
||||
Scopes: scopes,
|
||||
}),
|
||||
auth.NewBasicHandler(creds),
|
||||
}
|
||||
tokenHandler := auth.NewTokenHandlerWithOptions(tokenHandlerOptions)
|
||||
basicHandler := auth.NewBasicHandler(creds)
|
||||
modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler))
|
||||
|
||||
modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, authHandlers...))
|
||||
|
||||
return &http.Client{
|
||||
Transport: transport.NewTransport(authTransport, modifiers...),
|
||||
|
||||
Reference in New Issue
Block a user