mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
registry: un-export AuthTransport()
It's only used internally for v1 search Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2f466a9f88
commit
8947730124
2 changed files with 4 additions and 4 deletions
|
@ -24,7 +24,7 @@ func spawnTestRegistrySession(t *testing.T) *session {
|
||||||
}
|
}
|
||||||
userAgent := "docker test client"
|
userAgent := "docker test client"
|
||||||
var tr http.RoundTripper = debugTransport{newTransport(nil), t.Log}
|
var tr http.RoundTripper = debugTransport{newTransport(nil), t.Log}
|
||||||
tr = transport.NewTransport(AuthTransport(tr, authConfig, false), Headers(userAgent, nil)...)
|
tr = transport.NewTransport(newAuthTransport(tr, authConfig, false), Headers(userAgent, nil)...)
|
||||||
client := httpClient(tr)
|
client := httpClient(tr)
|
||||||
|
|
||||||
if err := authorizeClient(client, authConfig, endpoint); err != nil {
|
if err := authorizeClient(client, authConfig, endpoint); err != nil {
|
||||||
|
|
|
@ -39,7 +39,7 @@ type authTransport struct {
|
||||||
modReq map[*http.Request]*http.Request // original -> modified
|
modReq map[*http.Request]*http.Request // original -> modified
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthTransport handles the auth layer when communicating with a v1 registry (private or official)
|
// newAuthTransport handles the auth layer when communicating with a v1 registry (private or official)
|
||||||
//
|
//
|
||||||
// For private v1 registries, set alwaysSetBasicAuth to true.
|
// For private v1 registries, set alwaysSetBasicAuth to true.
|
||||||
//
|
//
|
||||||
|
@ -52,7 +52,7 @@ type authTransport struct {
|
||||||
// If the server sends a token without the client having requested it, it is ignored.
|
// If the server sends a token without the client having requested it, it is ignored.
|
||||||
//
|
//
|
||||||
// This RoundTripper also has a CancelRequest method important for correct timeout handling.
|
// This RoundTripper also has a CancelRequest method important for correct timeout handling.
|
||||||
func AuthTransport(base http.RoundTripper, authConfig *types.AuthConfig, alwaysSetBasicAuth bool) http.RoundTripper {
|
func newAuthTransport(base http.RoundTripper, authConfig *types.AuthConfig, alwaysSetBasicAuth bool) *authTransport {
|
||||||
if base == nil {
|
if base == nil {
|
||||||
base = http.DefaultTransport
|
base = http.DefaultTransport
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ func authorizeClient(client *http.Client, authConfig *types.AuthConfig, endpoint
|
||||||
|
|
||||||
// Annotate the transport unconditionally so that v2 can
|
// Annotate the transport unconditionally so that v2 can
|
||||||
// properly fallback on v1 when an image is not found.
|
// properly fallback on v1 when an image is not found.
|
||||||
client.Transport = AuthTransport(client.Transport, authConfig, alwaysSetBasicAuth)
|
client.Transport = newAuthTransport(client.Transport, authConfig, alwaysSetBasicAuth)
|
||||||
|
|
||||||
jar, err := cookiejar.New(nil)
|
jar, err := cookiejar.New(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue