Signed-off-by: Daniel Nephin <dnephin@gmail.com>
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
"github.com/docker/docker/api/client/lib" |
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 |
- "github.com/docker/docker/cliconfig" |
|
| 13 | 12 |
"github.com/docker/docker/pkg/parsers/filters" |
| 14 | 13 |
"github.com/docker/docker/registry" |
| 15 | 14 |
"github.com/docker/docker/runconfig" |
| ... | ... |
@@ -67,7 +66,7 @@ type apiClient interface {
|
| 67 | 67 |
NetworkInspect(networkID string) (types.NetworkResource, error) |
| 68 | 68 |
NetworkList() ([]types.NetworkResource, error) |
| 69 | 69 |
NetworkRemove(networkID string) error |
| 70 |
- RegistryLogin(auth cliconfig.AuthConfig) (types.AuthResponse, error) |
|
| 70 |
+ RegistryLogin(auth types.AuthConfig) (types.AuthResponse, error) |
|
| 71 | 71 |
ServerVersion() (types.Version, error) |
| 72 | 72 |
VolumeCreate(options types.VolumeCreateRequest) (types.Volume, error) |
| 73 | 73 |
VolumeInspect(volumeID string) (types.Volume, error) |
| ... | ... |
@@ -6,12 +6,11 @@ import ( |
| 6 | 6 |
"net/url" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 |
- "github.com/docker/docker/cliconfig" |
|
| 10 | 9 |
) |
| 11 | 10 |
|
| 12 | 11 |
// RegistryLogin authenticates the docker server with a given docker registry. |
| 13 | 12 |
// It returns UnauthorizerError when the authentication fails. |
| 14 |
-func (cli *Client) RegistryLogin(auth cliconfig.AuthConfig) (types.AuthResponse, error) {
|
|
| 13 |
+func (cli *Client) RegistryLogin(auth types.AuthConfig) (types.AuthResponse, error) {
|
|
| 15 | 14 |
resp, err := cli.post("/auth", url.Values{}, auth, nil)
|
| 16 | 15 |
|
| 17 | 16 |
if resp != nil && resp.statusCode == http.StatusUnauthorized {
|
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/api/client/lib" |
| 12 | 12 |
Cli "github.com/docker/docker/cli" |
| 13 |
- "github.com/docker/docker/cliconfig" |
|
| 14 | 13 |
flag "github.com/docker/docker/pkg/mflag" |
| 15 | 14 |
"github.com/docker/docker/pkg/term" |
| 16 | 15 |
"github.com/docker/docker/registry" |
| ... | ... |
@@ -63,7 +62,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
|
| 63 | 63 |
|
| 64 | 64 |
authconfig, ok := cli.configFile.AuthConfigs[serverAddress] |
| 65 | 65 |
if !ok {
|
| 66 |
- authconfig = cliconfig.AuthConfig{}
|
|
| 66 |
+ authconfig = types.AuthConfig{}
|
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
if username == "" {
|
| ... | ... |
@@ -76,9 +76,9 @@ func (cli *DockerCli) CmdPull(args ...string) error {
|
| 76 | 76 |
return cli.imagePullPrivileged(authConfig, distributionRef.String(), "", requestPrivilege) |
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 |
-func (cli *DockerCli) imagePullPrivileged(authConfig cliconfig.AuthConfig, imageID, tag string, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 79 |
+func (cli *DockerCli) imagePullPrivileged(authConfig types.AuthConfig, imageID, tag string, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 80 | 80 |
|
| 81 |
- encodedAuth, err := authConfig.EncodeToBase64() |
|
| 81 |
+ encodedAuth, err := cliconfig.EncodeAuthToBase64(authConfig) |
|
| 82 | 82 |
if err != nil {
|
| 83 | 83 |
return err |
| 84 | 84 |
} |
| ... | ... |
@@ -65,8 +65,8 @@ func (cli *DockerCli) CmdPush(args ...string) error {
|
| 65 | 65 |
return cli.imagePushPrivileged(authConfig, ref.Name(), tag, cli.out, requestPrivilege) |
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
-func (cli *DockerCli) imagePushPrivileged(authConfig cliconfig.AuthConfig, imageID, tag string, outputStream io.Writer, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 69 |
- encodedAuth, err := authConfig.EncodeToBase64() |
|
| 68 |
+func (cli *DockerCli) imagePushPrivileged(authConfig types.AuthConfig, imageID, tag string, outputStream io.Writer, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 69 |
+ encodedAuth, err := cliconfig.EncodeAuthToBase64(authConfig) |
|
| 70 | 70 |
if err != nil {
|
| 71 | 71 |
return err |
| 72 | 72 |
} |
| ... | ... |
@@ -9,6 +9,7 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
"github.com/docker/docker/api/types" |
| 11 | 11 |
Cli "github.com/docker/docker/cli" |
| 12 |
+ "github.com/docker/docker/cliconfig" |
|
| 12 | 13 |
flag "github.com/docker/docker/pkg/mflag" |
| 13 | 14 |
"github.com/docker/docker/pkg/stringutils" |
| 14 | 15 |
"github.com/docker/docker/registry" |
| ... | ... |
@@ -38,7 +39,7 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
|
| 38 | 38 |
authConfig := registry.ResolveAuthConfig(cli.configFile.AuthConfigs, indexInfo) |
| 39 | 39 |
requestPrivilege := cli.registryAuthenticationPrivilegedFunc(indexInfo, "search") |
| 40 | 40 |
|
| 41 |
- encodedAuth, err := authConfig.EncodeToBase64() |
|
| 41 |
+ encodedAuth, err := cliconfig.EncodeAuthToBase64(authConfig) |
|
| 42 | 42 |
if err != nil {
|
| 43 | 43 |
return err |
| 44 | 44 |
} |
| ... | ... |
@@ -97,14 +97,14 @@ func trustServer(index *registry.IndexInfo) (string, error) {
|
| 97 | 97 |
} |
| 98 | 98 |
|
| 99 | 99 |
type simpleCredentialStore struct {
|
| 100 |
- auth cliconfig.AuthConfig |
|
| 100 |
+ auth types.AuthConfig |
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
func (scs simpleCredentialStore) Basic(u *url.URL) (string, string) {
|
| 104 | 104 |
return scs.auth.Username, scs.auth.Password |
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 |
-func (cli *DockerCli) getNotaryRepository(repoInfo *registry.RepositoryInfo, authConfig cliconfig.AuthConfig) (*client.NotaryRepository, error) {
|
|
| 107 |
+func (cli *DockerCli) getNotaryRepository(repoInfo *registry.RepositoryInfo, authConfig types.AuthConfig) (*client.NotaryRepository, error) {
|
|
| 108 | 108 |
server, err := trustServer(repoInfo.Index) |
| 109 | 109 |
if err != nil {
|
| 110 | 110 |
return nil, err |
| ... | ... |
@@ -279,7 +279,7 @@ func notaryError(err error) error {
|
| 279 | 279 |
return err |
| 280 | 280 |
} |
| 281 | 281 |
|
| 282 |
-func (cli *DockerCli) trustedPull(repoInfo *registry.RepositoryInfo, ref registry.Reference, authConfig cliconfig.AuthConfig, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 282 |
+func (cli *DockerCli) trustedPull(repoInfo *registry.RepositoryInfo, ref registry.Reference, authConfig types.AuthConfig, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 283 | 283 |
var refs []target |
| 284 | 284 |
|
| 285 | 285 |
notaryRepo, err := cli.getNotaryRepository(repoInfo, authConfig) |
| ... | ... |
@@ -380,7 +380,7 @@ func targetStream(in io.Writer) (io.WriteCloser, <-chan []target) {
|
| 380 | 380 |
return ioutils.NewWriteCloserWrapper(out, w.Close), targetChan |
| 381 | 381 |
} |
| 382 | 382 |
|
| 383 |
-func (cli *DockerCli) trustedPush(repoInfo *registry.RepositoryInfo, tag string, authConfig cliconfig.AuthConfig, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 383 |
+func (cli *DockerCli) trustedPush(repoInfo *registry.RepositoryInfo, tag string, authConfig types.AuthConfig, requestPrivilege lib.RequestPrivilegeFunc) error {
|
|
| 384 | 384 |
streamOut, targetChan := targetStream(cli.out) |
| 385 | 385 |
|
| 386 | 386 |
reqError := cli.imagePushPrivileged(authConfig, repoInfo.LocalName.Name(), tag, streamOut, requestPrivilege) |
| ... | ... |
@@ -1,6 +1,8 @@ |
| 1 | 1 |
package client |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "encoding/base64" |
|
| 5 |
+ "encoding/json" |
|
| 4 | 6 |
"fmt" |
| 5 | 7 |
"os" |
| 6 | 8 |
gosignal "os/signal" |
| ... | ... |
@@ -15,9 +17,18 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/registry" |
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 |
+// encodeAuthToBase64 serializes the auth configuration as JSON base64 payload |
|
| 19 |
+func encodeAuthToBase64(authConfig AuthConfig) (string, error) {
|
|
| 20 |
+ buf, err := json.Marshal(authConfig) |
|
| 21 |
+ if err != nil {
|
|
| 22 |
+ return "", err |
|
| 23 |
+ } |
|
| 24 |
+ return base64.URLEncoding.EncodeToString(buf), nil |
|
| 25 |
+} |
|
| 26 |
+ |
|
| 18 | 27 |
func (cli *DockerCli) encodeRegistryAuth(index *registry.IndexInfo) (string, error) {
|
| 19 | 28 |
authConfig := registry.ResolveAuthConfig(cli.configFile.AuthConfigs, index) |
| 20 |
- return authConfig.EncodeToBase64() |
|
| 29 |
+ return cliconfig.EncodeAuthToBase64(authConfig) |
|
| 21 | 30 |
} |
| 22 | 31 |
|
| 23 | 32 |
func (cli *DockerCli) registryAuthenticationPrivilegedFunc(index *registry.IndexInfo, cmdName string) lib.RequestPrivilegeFunc {
|
| ... | ... |
@@ -17,7 +17,6 @@ import ( |
| 17 | 17 |
"github.com/docker/docker/api/types" |
| 18 | 18 |
"github.com/docker/docker/builder" |
| 19 | 19 |
"github.com/docker/docker/builder/dockerfile" |
| 20 |
- "github.com/docker/docker/cliconfig" |
|
| 21 | 20 |
"github.com/docker/docker/daemon/daemonbuilder" |
| 22 | 21 |
derr "github.com/docker/docker/errors" |
| 23 | 22 |
"github.com/docker/docker/pkg/archive" |
| ... | ... |
@@ -91,13 +90,13 @@ func (s *router) postImagesCreate(ctx context.Context, w http.ResponseWriter, r |
| 91 | 91 |
message = r.Form.Get("message")
|
| 92 | 92 |
) |
| 93 | 93 |
authEncoded := r.Header.Get("X-Registry-Auth")
|
| 94 |
- authConfig := &cliconfig.AuthConfig{}
|
|
| 94 |
+ authConfig := &types.AuthConfig{}
|
|
| 95 | 95 |
if authEncoded != "" {
|
| 96 | 96 |
authJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded)) |
| 97 | 97 |
if err := json.NewDecoder(authJSON).Decode(authConfig); err != nil {
|
| 98 | 98 |
// for a pull it is not an error if no auth was given |
| 99 | 99 |
// to increase compatibility with the existing api it is defaulting to be empty |
| 100 |
- authConfig = &cliconfig.AuthConfig{}
|
|
| 100 |
+ authConfig = &types.AuthConfig{}
|
|
| 101 | 101 |
} |
| 102 | 102 |
} |
| 103 | 103 |
|
| ... | ... |
@@ -195,7 +194,7 @@ func (s *router) postImagesPush(ctx context.Context, w http.ResponseWriter, r *h |
| 195 | 195 |
if err := httputils.ParseForm(r); err != nil {
|
| 196 | 196 |
return err |
| 197 | 197 |
} |
| 198 |
- authConfig := &cliconfig.AuthConfig{}
|
|
| 198 |
+ authConfig := &types.AuthConfig{}
|
|
| 199 | 199 |
|
| 200 | 200 |
authEncoded := r.Header.Get("X-Registry-Auth")
|
| 201 | 201 |
if authEncoded != "" {
|
| ... | ... |
@@ -203,7 +202,7 @@ func (s *router) postImagesPush(ctx context.Context, w http.ResponseWriter, r *h |
| 203 | 203 |
authJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded)) |
| 204 | 204 |
if err := json.NewDecoder(authJSON).Decode(authConfig); err != nil {
|
| 205 | 205 |
// to increase compatibility to existing api it is defaulting to be empty |
| 206 |
- authConfig = &cliconfig.AuthConfig{}
|
|
| 206 |
+ authConfig = &types.AuthConfig{}
|
|
| 207 | 207 |
} |
| 208 | 208 |
} else {
|
| 209 | 209 |
// the old format is supported for compatibility if there was no authConfig header |
| ... | ... |
@@ -303,7 +302,7 @@ func (s *router) getImagesByName(ctx context.Context, w http.ResponseWriter, r * |
| 303 | 303 |
|
| 304 | 304 |
func (s *router) postBuild(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 305 | 305 |
var ( |
| 306 |
- authConfigs = map[string]cliconfig.AuthConfig{}
|
|
| 306 |
+ authConfigs = map[string]types.AuthConfig{}
|
|
| 307 | 307 |
authConfigsEncoded = r.Header.Get("X-Registry-Config")
|
| 308 | 308 |
buildConfig = &dockerfile.Config{}
|
| 309 | 309 |
) |
| ... | ... |
@@ -560,7 +559,7 @@ func (s *router) getImagesSearch(ctx context.Context, w http.ResponseWriter, r * |
| 560 | 560 |
return err |
| 561 | 561 |
} |
| 562 | 562 |
var ( |
| 563 |
- config *cliconfig.AuthConfig |
|
| 563 |
+ config *types.AuthConfig |
|
| 564 | 564 |
authEncoded = r.Header.Get("X-Registry-Auth")
|
| 565 | 565 |
headers = map[string][]string{}
|
| 566 | 566 |
) |
| ... | ... |
@@ -570,7 +569,7 @@ func (s *router) getImagesSearch(ctx context.Context, w http.ResponseWriter, r * |
| 570 | 570 |
if err := json.NewDecoder(authJSON).Decode(&config); err != nil {
|
| 571 | 571 |
// for a search it is not an error if no auth was given |
| 572 | 572 |
// to increase compatibility with the existing api it is defaulting to be empty |
| 573 |
- config = &cliconfig.AuthConfig{}
|
|
| 573 |
+ config = &types.AuthConfig{}
|
|
| 574 | 574 |
} |
| 575 | 575 |
} |
| 576 | 576 |
for k, v := range r.Header {
|
| ... | ... |
@@ -2,7 +2,6 @@ package system |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"github.com/docker/docker/api/types" |
| 5 |
- "github.com/docker/docker/cliconfig" |
|
| 6 | 5 |
"github.com/docker/docker/pkg/jsonmessage" |
| 7 | 6 |
"github.com/docker/docker/pkg/parsers/filters" |
| 8 | 7 |
) |
| ... | ... |
@@ -14,5 +13,5 @@ type Backend interface {
|
| 14 | 14 |
SystemVersion() types.Version |
| 15 | 15 |
SubscribeToEvents(since, sinceNano int64, ef filters.Args) ([]*jsonmessage.JSONMessage, chan interface{})
|
| 16 | 16 |
UnsubscribeFromEvents(chan interface{})
|
| 17 |
- AuthenticateToRegistry(authConfig *cliconfig.AuthConfig) (string, error) |
|
| 17 |
+ AuthenticateToRegistry(authConfig *types.AuthConfig) (string, error) |
|
| 18 | 18 |
} |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api" |
| 10 | 10 |
"github.com/docker/docker/api/server/httputils" |
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 |
- "github.com/docker/docker/cliconfig" |
|
| 13 | 12 |
"github.com/docker/docker/pkg/ioutils" |
| 14 | 13 |
"github.com/docker/docker/pkg/jsonmessage" |
| 15 | 14 |
"github.com/docker/docker/pkg/parsers/filters" |
| ... | ... |
@@ -116,7 +115,7 @@ func (s *systemRouter) getEvents(ctx context.Context, w http.ResponseWriter, r * |
| 116 | 116 |
} |
| 117 | 117 |
|
| 118 | 118 |
func (s *systemRouter) postAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 119 |
- var config *cliconfig.AuthConfig |
|
| 119 |
+ var config *types.AuthConfig |
|
| 120 | 120 |
err := json.NewDecoder(r.Body).Decode(&config) |
| 121 | 121 |
r.Body.Close() |
| 122 | 122 |
if err != nil {
|
| 123 | 123 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,11 @@ |
| 0 |
+package types |
|
| 1 |
+ |
|
| 2 |
+// AuthConfig contains authorization information for connecting to a Registry |
|
| 3 |
+type AuthConfig struct {
|
|
| 4 |
+ Username string `json:"username,omitempty"` |
|
| 5 |
+ Password string `json:"password,omitempty"` |
|
| 6 |
+ Auth string `json:"auth"` |
|
| 7 |
+ Email string `json:"email"` |
|
| 8 |
+ ServerAddress string `json:"serveraddress,omitempty"` |
|
| 9 |
+ RegistryToken string `json:"registrytoken,omitempty"` |
|
| 10 |
+} |
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
"io" |
| 6 | 6 |
"net" |
| 7 | 7 |
|
| 8 |
- "github.com/docker/docker/cliconfig" |
|
| 9 | 8 |
"github.com/docker/docker/pkg/parsers/filters" |
| 10 | 9 |
"github.com/docker/docker/pkg/ulimit" |
| 11 | 10 |
"github.com/docker/docker/runconfig" |
| ... | ... |
@@ -135,7 +134,7 @@ type ImageBuildOptions struct {
|
| 135 | 135 |
Dockerfile string |
| 136 | 136 |
Ulimits []*ulimit.Ulimit |
| 137 | 137 |
BuildArgs []string |
| 138 |
- AuthConfigs map[string]cliconfig.AuthConfig |
|
| 138 |
+ AuthConfigs map[string]types.AuthConfig |
|
| 139 | 139 |
Context io.Reader |
| 140 | 140 |
} |
| 141 | 141 |
|
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
"path/filepath" |
| 11 | 11 |
"strings" |
| 12 | 12 |
|
| 13 |
+ "github.com/docker/docker/api/types" |
|
| 13 | 14 |
"github.com/docker/docker/pkg/homedir" |
| 14 | 15 |
) |
| 15 | 16 |
|
| ... | ... |
@@ -44,19 +45,9 @@ func SetConfigDir(dir string) {
|
| 44 | 44 |
configDir = dir |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 |
-// AuthConfig contains authorization information for connecting to a Registry |
|
| 48 |
-type AuthConfig struct {
|
|
| 49 |
- Username string `json:"username,omitempty"` |
|
| 50 |
- Password string `json:"password,omitempty"` |
|
| 51 |
- Auth string `json:"auth"` |
|
| 52 |
- Email string `json:"email"` |
|
| 53 |
- ServerAddress string `json:"serveraddress,omitempty"` |
|
| 54 |
- RegistryToken string `json:"registrytoken,omitempty"` |
|
| 55 |
-} |
|
| 56 |
- |
|
| 57 |
-// EncodeToBase64 serializes the auth configuration as JSON base64 payload |
|
| 58 |
-func (a AuthConfig) EncodeToBase64() (string, error) {
|
|
| 59 |
- buf, err := json.Marshal(a) |
|
| 47 |
+// EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload |
|
| 48 |
+func EncodeAuthToBase64(authConfig AuthConfig) (string, error) {
|
|
| 49 |
+ buf, err := json.Marshal(authConfig) |
|
| 60 | 50 |
if err != nil {
|
| 61 | 51 |
return "", err |
| 62 | 52 |
} |
| ... | ... |
@@ -65,16 +56,16 @@ func (a AuthConfig) EncodeToBase64() (string, error) {
|
| 65 | 65 |
|
| 66 | 66 |
// ConfigFile ~/.docker/config.json file info |
| 67 | 67 |
type ConfigFile struct {
|
| 68 |
- AuthConfigs map[string]AuthConfig `json:"auths"` |
|
| 69 |
- HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` |
|
| 70 |
- PsFormat string `json:"psFormat,omitempty"` |
|
| 71 |
- filename string // Note: not serialized - for internal use only |
|
| 68 |
+ AuthConfigs map[string]types.AuthConfig `json:"auths"` |
|
| 69 |
+ HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` |
|
| 70 |
+ PsFormat string `json:"psFormat,omitempty"` |
|
| 71 |
+ filename string // Note: not serialized - for internal use only |
|
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 | 74 |
// NewConfigFile initializes an empty configuration file for the given filename 'fn' |
| 75 | 75 |
func NewConfigFile(fn string) *ConfigFile {
|
| 76 | 76 |
return &ConfigFile{
|
| 77 |
- AuthConfigs: make(map[string]AuthConfig), |
|
| 77 |
+ AuthConfigs: make(map[string]types.AuthConfig), |
|
| 78 | 78 |
HTTPHeaders: make(map[string]string), |
| 79 | 79 |
filename: fn, |
| 80 | 80 |
} |
| ... | ... |
@@ -93,7 +84,7 @@ func (configFile *ConfigFile) LegacyLoadFromReader(configData io.Reader) error {
|
| 93 | 93 |
if len(arr) < 2 {
|
| 94 | 94 |
return fmt.Errorf("The Auth config file is empty")
|
| 95 | 95 |
} |
| 96 |
- authConfig := AuthConfig{}
|
|
| 96 |
+ authConfig := types.AuthConfig{}
|
|
| 97 | 97 |
origAuth := strings.Split(arr[0], " = ") |
| 98 | 98 |
if len(origAuth) != 2 {
|
| 99 | 99 |
return fmt.Errorf("Invalid Auth config file")
|
| ... | ... |
@@ -146,7 +137,7 @@ func (configFile *ConfigFile) LoadFromReader(configData io.Reader) error {
|
| 146 | 146 |
// a non-nested reader |
| 147 | 147 |
func LegacyLoadFromReader(configData io.Reader) (*ConfigFile, error) {
|
| 148 | 148 |
configFile := ConfigFile{
|
| 149 |
- AuthConfigs: make(map[string]AuthConfig), |
|
| 149 |
+ AuthConfigs: make(map[string]types.AuthConfig), |
|
| 150 | 150 |
} |
| 151 | 151 |
err := configFile.LegacyLoadFromReader(configData) |
| 152 | 152 |
return &configFile, err |
| ... | ... |
@@ -156,7 +147,7 @@ func LegacyLoadFromReader(configData io.Reader) (*ConfigFile, error) {
|
| 156 | 156 |
// a reader |
| 157 | 157 |
func LoadFromReader(configData io.Reader) (*ConfigFile, error) {
|
| 158 | 158 |
configFile := ConfigFile{
|
| 159 |
- AuthConfigs: make(map[string]AuthConfig), |
|
| 159 |
+ AuthConfigs: make(map[string]types.AuthConfig), |
|
| 160 | 160 |
} |
| 161 | 161 |
err := configFile.LoadFromReader(configData) |
| 162 | 162 |
return &configFile, err |
| ... | ... |
@@ -171,7 +162,7 @@ func Load(configDir string) (*ConfigFile, error) {
|
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
configFile := ConfigFile{
|
| 174 |
- AuthConfigs: make(map[string]AuthConfig), |
|
| 174 |
+ AuthConfigs: make(map[string]types.AuthConfig), |
|
| 175 | 175 |
filename: filepath.Join(configDir, ConfigFileName), |
| 176 | 176 |
} |
| 177 | 177 |
|
| ... | ... |
@@ -215,7 +206,7 @@ func Load(configDir string) (*ConfigFile, error) {
|
| 215 | 215 |
// the given writer |
| 216 | 216 |
func (configFile *ConfigFile) SaveToWriter(writer io.Writer) error {
|
| 217 | 217 |
// Encode sensitive data into a new/temp struct |
| 218 |
- tmpAuthConfigs := make(map[string]AuthConfig, len(configFile.AuthConfigs)) |
|
| 218 |
+ tmpAuthConfigs := make(map[string]types.AuthConfig, len(configFile.AuthConfigs)) |
|
| 219 | 219 |
for k, authConfig := range configFile.AuthConfigs {
|
| 220 | 220 |
authCopy := authConfig |
| 221 | 221 |
// encode and save the authstring, while blanking out the original fields |
| ... | ... |
@@ -261,7 +252,7 @@ func (configFile *ConfigFile) Filename() string {
|
| 261 | 261 |
} |
| 262 | 262 |
|
| 263 | 263 |
// EncodeAuth creates a base64 encoded string to containing authorization information |
| 264 |
-func EncodeAuth(authConfig *AuthConfig) string {
|
|
| 264 |
+func EncodeAuth(authConfig *types.AuthConfig) string {
|
|
| 265 | 265 |
authStr := authConfig.Username + ":" + authConfig.Password |
| 266 | 266 |
msg := []byte(authStr) |
| 267 | 267 |
encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg))) |
| ... | ... |
@@ -22,7 +22,6 @@ import ( |
| 22 | 22 |
"github.com/docker/distribution/reference" |
| 23 | 23 |
"github.com/docker/docker/api" |
| 24 | 24 |
"github.com/docker/docker/api/types" |
| 25 |
- "github.com/docker/docker/cliconfig" |
|
| 26 | 25 |
"github.com/docker/docker/container" |
| 27 | 26 |
"github.com/docker/docker/daemon/events" |
| 28 | 27 |
"github.com/docker/docker/daemon/exec" |
| ... | ... |
@@ -1069,7 +1068,7 @@ func writeDistributionProgress(cancelFunc func(), outStream io.Writer, progressC |
| 1069 | 1069 |
|
| 1070 | 1070 |
// PullImage initiates a pull operation. image is the repository name to pull, and |
| 1071 | 1071 |
// tag may be either empty, or indicate a specific tag to pull. |
| 1072 |
-func (daemon *Daemon) PullImage(ref reference.Named, metaHeaders map[string][]string, authConfig *cliconfig.AuthConfig, outStream io.Writer) error {
|
|
| 1072 |
+func (daemon *Daemon) PullImage(ref reference.Named, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error {
|
|
| 1073 | 1073 |
// Include a buffer so that slow client connections don't affect |
| 1074 | 1074 |
// transfer performance. |
| 1075 | 1075 |
progressChan := make(chan progress.Progress, 100) |
| ... | ... |
@@ -1112,7 +1111,7 @@ func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
| 1112 | 1112 |
} |
| 1113 | 1113 |
|
| 1114 | 1114 |
// PushImage initiates a push operation on the repository named localName. |
| 1115 |
-func (daemon *Daemon) PushImage(ref reference.Named, metaHeaders map[string][]string, authConfig *cliconfig.AuthConfig, outStream io.Writer) error {
|
|
| 1115 |
+func (daemon *Daemon) PushImage(ref reference.Named, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error {
|
|
| 1116 | 1116 |
// Include a buffer so that slow client connections don't affect |
| 1117 | 1117 |
// transfer performance. |
| 1118 | 1118 |
progressChan := make(chan progress.Progress, 100) |
| ... | ... |
@@ -1501,14 +1500,14 @@ func configureVolumes(config *Config, rootUID, rootGID int) (*store.VolumeStore, |
| 1501 | 1501 |
} |
| 1502 | 1502 |
|
| 1503 | 1503 |
// AuthenticateToRegistry checks the validity of credentials in authConfig |
| 1504 |
-func (daemon *Daemon) AuthenticateToRegistry(authConfig *cliconfig.AuthConfig) (string, error) {
|
|
| 1504 |
+func (daemon *Daemon) AuthenticateToRegistry(authConfig *types.AuthConfig) (string, error) {
|
|
| 1505 | 1505 |
return daemon.RegistryService.Auth(authConfig) |
| 1506 | 1506 |
} |
| 1507 | 1507 |
|
| 1508 | 1508 |
// SearchRegistryForImages queries the registry for images matching |
| 1509 | 1509 |
// term. authConfig is used to login. |
| 1510 | 1510 |
func (daemon *Daemon) SearchRegistryForImages(term string, |
| 1511 |
- authConfig *cliconfig.AuthConfig, |
|
| 1511 |
+ authConfig *types.AuthConfig, |
|
| 1512 | 1512 |
headers map[string][]string) (*registry.SearchResults, error) {
|
| 1513 | 1513 |
return daemon.RegistryService.Search(term, authConfig, headers) |
| 1514 | 1514 |
} |
| ... | ... |
@@ -30,7 +30,7 @@ import ( |
| 30 | 30 |
type Docker struct {
|
| 31 | 31 |
Daemon *daemon.Daemon |
| 32 | 32 |
OutOld io.Writer |
| 33 |
- AuthConfigs map[string]cliconfig.AuthConfig |
|
| 33 |
+ AuthConfigs map[string]types.AuthConfig |
|
| 34 | 34 |
Archiver *archive.Archiver |
| 35 | 35 |
} |
| 36 | 36 |
|
| ... | ... |
@@ -58,7 +58,7 @@ func (d Docker) Pull(name string) (*image.Image, error) {
|
| 58 | 58 |
} |
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 |
- pullRegistryAuth := &cliconfig.AuthConfig{}
|
|
| 61 |
+ pullRegistryAuth := &types.AuthConfig{}
|
|
| 62 | 62 |
if len(d.AuthConfigs) > 0 {
|
| 63 | 63 |
// The request came with a full auth config file, we prefer to use that |
| 64 | 64 |
repoInfo, err := d.Daemon.RegistryService.ResolveRepository(ref) |
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/Sirupsen/logrus" |
| 9 | 9 |
"github.com/docker/distribution/reference" |
| 10 |
- "github.com/docker/docker/cliconfig" |
|
| 11 | 10 |
"github.com/docker/docker/daemon/events" |
| 12 | 11 |
"github.com/docker/docker/distribution/metadata" |
| 13 | 12 |
"github.com/docker/docker/distribution/xfer" |
| ... | ... |
@@ -25,7 +24,7 @@ type ImagePullConfig struct {
|
| 25 | 25 |
MetaHeaders map[string][]string |
| 26 | 26 |
// AuthConfig holds authentication credentials for authenticating with |
| 27 | 27 |
// the registry. |
| 28 |
- AuthConfig *cliconfig.AuthConfig |
|
| 28 |
+ AuthConfig *types.AuthConfig |
|
| 29 | 29 |
// ProgressOutput is the interface for showing the status of the pull |
| 30 | 30 |
// operation. |
| 31 | 31 |
ProgressOutput progress.Output |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"github.com/Sirupsen/logrus" |
| 10 | 10 |
"github.com/docker/distribution/digest" |
| 11 | 11 |
"github.com/docker/distribution/reference" |
| 12 |
- "github.com/docker/docker/cliconfig" |
|
| 13 | 12 |
"github.com/docker/docker/daemon/events" |
| 14 | 13 |
"github.com/docker/docker/distribution/metadata" |
| 15 | 14 |
"github.com/docker/docker/distribution/xfer" |
| ... | ... |
@@ -29,7 +28,7 @@ type ImagePushConfig struct {
|
| 29 | 29 |
MetaHeaders map[string][]string |
| 30 | 30 |
// AuthConfig holds authentication credentials for authenticating with |
| 31 | 31 |
// the registry. |
| 32 |
- AuthConfig *cliconfig.AuthConfig |
|
| 32 |
+ AuthConfig *types.AuthConfig |
|
| 33 | 33 |
// ProgressOutput is the interface for showing the status of the push |
| 34 | 34 |
// operation. |
| 35 | 35 |
ProgressOutput progress.Output |
| ... | ... |
@@ -17,14 +17,13 @@ import ( |
| 17 | 17 |
"github.com/docker/distribution/registry/client" |
| 18 | 18 |
"github.com/docker/distribution/registry/client/auth" |
| 19 | 19 |
"github.com/docker/distribution/registry/client/transport" |
| 20 |
- "github.com/docker/docker/cliconfig" |
|
| 21 | 20 |
"github.com/docker/docker/distribution/xfer" |
| 22 | 21 |
"github.com/docker/docker/registry" |
| 23 | 22 |
"golang.org/x/net/context" |
| 24 | 23 |
) |
| 25 | 24 |
|
| 26 | 25 |
type dumbCredentialStore struct {
|
| 27 |
- auth *cliconfig.AuthConfig |
|
| 26 |
+ auth *types.AuthConfig |
|
| 28 | 27 |
} |
| 29 | 28 |
|
| 30 | 29 |
func (dcs dumbCredentialStore) Basic(*url.URL) (string, string) {
|
| ... | ... |
@@ -34,7 +33,7 @@ func (dcs dumbCredentialStore) Basic(*url.URL) (string, string) {
|
| 34 | 34 |
// NewV2Repository returns a repository (v2 only). It creates a HTTP transport |
| 35 | 35 |
// providing timeout settings and authentication support, and also verifies the |
| 36 | 36 |
// remote API version. |
| 37 |
-func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, metaHeaders http.Header, authConfig *cliconfig.AuthConfig, actions ...string) (distribution.Repository, error) {
|
|
| 37 |
+func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, metaHeaders http.Header, authConfig *types.AuthConfig, actions ...string) (distribution.Repository, error) {
|
|
| 38 | 38 |
ctx := context.Background() |
| 39 | 39 |
|
| 40 | 40 |
repoName := repoInfo.CanonicalName |
| ... | ... |
@@ -10,14 +10,13 @@ import ( |
| 10 | 10 |
"github.com/Sirupsen/logrus" |
| 11 | 11 |
"github.com/docker/distribution/reference" |
| 12 | 12 |
"github.com/docker/distribution/registry/client/auth" |
| 13 |
- "github.com/docker/docker/cliconfig" |
|
| 14 | 13 |
"github.com/docker/docker/registry" |
| 15 | 14 |
"github.com/docker/docker/utils" |
| 16 | 15 |
"golang.org/x/net/context" |
| 17 | 16 |
) |
| 18 | 17 |
|
| 19 | 18 |
func TestTokenPassThru(t *testing.T) {
|
| 20 |
- authConfig := &cliconfig.AuthConfig{
|
|
| 19 |
+ authConfig := &types.AuthConfig{
|
|
| 21 | 20 |
RegistryToken: "mysecrettoken", |
| 22 | 21 |
} |
| 23 | 22 |
gotToken := false |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
// Login tries to register/login to the registry server. |
| 15 |
-func Login(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint) (string, error) {
|
|
| 15 |
+func Login(authConfig *types.AuthConfig, registryEndpoint *Endpoint) (string, error) {
|
|
| 16 | 16 |
// Separates the v2 registry login logic from the v1 logic. |
| 17 | 17 |
if registryEndpoint.Version == APIVersion2 {
|
| 18 | 18 |
return loginV2(authConfig, registryEndpoint, "" /* scope */) |
| ... | ... |
@@ -21,7 +21,7 @@ func Login(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint) (string |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
// loginV1 tries to register/login to the v1 registry server. |
| 24 |
-func loginV1(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint) (string, error) {
|
|
| 24 |
+func loginV1(authConfig *types.AuthConfig, registryEndpoint *Endpoint) (string, error) {
|
|
| 25 | 25 |
var ( |
| 26 | 26 |
status string |
| 27 | 27 |
respBody []byte |
| ... | ... |
@@ -136,7 +136,7 @@ func loginV1(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint) (stri |
| 136 | 136 |
// now, users should create their account through other means like directly from a web page |
| 137 | 137 |
// served by the v2 registry service provider. Whether this will be supported in the future |
| 138 | 138 |
// is to be determined. |
| 139 |
-func loginV2(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint, scope string) (string, error) {
|
|
| 139 |
+func loginV2(authConfig *types.AuthConfig, registryEndpoint *Endpoint, scope string) (string, error) {
|
|
| 140 | 140 |
logrus.Debugf("attempting v2 login to registry endpoint %s", registryEndpoint)
|
| 141 | 141 |
var ( |
| 142 | 142 |
err error |
| ... | ... |
@@ -173,7 +173,7 @@ func loginV2(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint, scope |
| 173 | 173 |
return "", fmt.Errorf("no successful auth challenge for %s - errors: %s", registryEndpoint, allErrors)
|
| 174 | 174 |
} |
| 175 | 175 |
|
| 176 |
-func tryV2BasicAuthLogin(authConfig *cliconfig.AuthConfig, params map[string]string, registryEndpoint *Endpoint) error {
|
|
| 176 |
+func tryV2BasicAuthLogin(authConfig *types.AuthConfig, params map[string]string, registryEndpoint *Endpoint) error {
|
|
| 177 | 177 |
req, err := http.NewRequest("GET", registryEndpoint.Path(""), nil)
|
| 178 | 178 |
if err != nil {
|
| 179 | 179 |
return err |
| ... | ... |
@@ -194,7 +194,7 @@ func tryV2BasicAuthLogin(authConfig *cliconfig.AuthConfig, params map[string]str |
| 194 | 194 |
return nil |
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 |
-func tryV2TokenAuthLogin(authConfig *cliconfig.AuthConfig, params map[string]string, registryEndpoint *Endpoint) error {
|
|
| 197 |
+func tryV2TokenAuthLogin(authConfig *types.AuthConfig, params map[string]string, registryEndpoint *Endpoint) error {
|
|
| 198 | 198 |
token, err := getToken(authConfig.Username, authConfig.Password, params, registryEndpoint) |
| 199 | 199 |
if err != nil {
|
| 200 | 200 |
return err |
| ... | ... |
@@ -221,7 +221,7 @@ func tryV2TokenAuthLogin(authConfig *cliconfig.AuthConfig, params map[string]str |
| 221 | 221 |
} |
| 222 | 222 |
|
| 223 | 223 |
// ResolveAuthConfig matches an auth configuration to a server address or a URL |
| 224 |
-func ResolveAuthConfig(authConfigs map[string]cliconfig.AuthConfig, index *IndexInfo) cliconfig.AuthConfig {
|
|
| 224 |
+func ResolveAuthConfig(authConfigs map[string]types.AuthConfig, index *IndexInfo) types.AuthConfig {
|
|
| 225 | 225 |
configKey := index.GetAuthConfigKey() |
| 226 | 226 |
// First try the happy case |
| 227 | 227 |
if c, found := authConfigs[configKey]; found || index.Official {
|
| ... | ... |
@@ -250,5 +250,5 @@ func ResolveAuthConfig(authConfigs map[string]cliconfig.AuthConfig, index *Index |
| 250 | 250 |
} |
| 251 | 251 |
|
| 252 | 252 |
// When all else fails, return an empty auth config |
| 253 |
- return cliconfig.AuthConfig{}
|
|
| 253 |
+ return types.AuthConfig{}
|
|
| 254 | 254 |
} |
| ... | ... |
@@ -7,9 +7,9 @@ import ( |
| 7 | 7 |
) |
| 8 | 8 |
|
| 9 | 9 |
func TestEncodeAuth(t *testing.T) {
|
| 10 |
- newAuthConfig := &cliconfig.AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
|
|
| 10 |
+ newAuthConfig := &types.AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
|
|
| 11 | 11 |
authStr := cliconfig.EncodeAuth(newAuthConfig) |
| 12 |
- decAuthConfig := &cliconfig.AuthConfig{}
|
|
| 12 |
+ decAuthConfig := &types.AuthConfig{}
|
|
| 13 | 13 |
var err error |
| 14 | 14 |
decAuthConfig.Username, decAuthConfig.Password, err = cliconfig.DecodeAuth(authStr) |
| 15 | 15 |
if err != nil {
|
| ... | ... |
@@ -30,7 +30,7 @@ func buildAuthConfigs() map[string]cliconfig.AuthConfig {
|
| 30 | 30 |
authConfigs := map[string]cliconfig.AuthConfig{}
|
| 31 | 31 |
|
| 32 | 32 |
for _, registry := range []string{"testIndex", IndexServer} {
|
| 33 |
- authConfigs[registry] = cliconfig.AuthConfig{
|
|
| 33 |
+ authConfigs[registry] = types.AuthConfig{
|
|
| 34 | 34 |
Username: "docker-user", |
| 35 | 35 |
Password: "docker-pass", |
| 36 | 36 |
Email: "docker@docker.io", |
| ... | ... |
@@ -78,24 +78,24 @@ func TestResolveAuthConfigIndexServer(t *testing.T) {
|
| 78 | 78 |
func TestResolveAuthConfigFullURL(t *testing.T) {
|
| 79 | 79 |
authConfigs := buildAuthConfigs() |
| 80 | 80 |
|
| 81 |
- registryAuth := cliconfig.AuthConfig{
|
|
| 81 |
+ registryAuth := types.AuthConfig{
|
|
| 82 | 82 |
Username: "foo-user", |
| 83 | 83 |
Password: "foo-pass", |
| 84 | 84 |
Email: "foo@example.com", |
| 85 | 85 |
} |
| 86 |
- localAuth := cliconfig.AuthConfig{
|
|
| 86 |
+ localAuth := types.AuthConfig{
|
|
| 87 | 87 |
Username: "bar-user", |
| 88 | 88 |
Password: "bar-pass", |
| 89 | 89 |
Email: "bar@example.com", |
| 90 | 90 |
} |
| 91 |
- officialAuth := cliconfig.AuthConfig{
|
|
| 91 |
+ officialAuth := types.AuthConfig{
|
|
| 92 | 92 |
Username: "baz-user", |
| 93 | 93 |
Password: "baz-pass", |
| 94 | 94 |
Email: "baz@example.com", |
| 95 | 95 |
} |
| 96 | 96 |
authConfigs[IndexServer] = officialAuth |
| 97 | 97 |
|
| 98 |
- expectedAuths := map[string]cliconfig.AuthConfig{
|
|
| 98 |
+ expectedAuths := map[string]types.AuthConfig{
|
|
| 99 | 99 |
"registry.example.com": registryAuth, |
| 100 | 100 |
"localhost:8000": localAuth, |
| 101 | 101 |
"registry.com": localAuth, |
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/distribution/reference" |
| 12 | 12 |
"github.com/docker/distribution/registry/client/transport" |
| 13 |
- "github.com/docker/docker/cliconfig" |
|
| 14 | 13 |
) |
| 15 | 14 |
|
| 16 | 15 |
var ( |
| ... | ... |
@@ -23,7 +22,7 @@ const ( |
| 23 | 23 |
) |
| 24 | 24 |
|
| 25 | 25 |
func spawnTestRegistrySession(t *testing.T) *Session {
|
| 26 |
- authConfig := &cliconfig.AuthConfig{}
|
|
| 26 |
+ authConfig := &types.AuthConfig{}
|
|
| 27 | 27 |
endpoint, err := NewEndpoint(makeIndex("/v1/"), nil, APIVersionUnknown)
|
| 28 | 28 |
if err != nil {
|
| 29 | 29 |
t.Fatal(err) |
| ... | ... |
@@ -8,7 +8,6 @@ import ( |
| 8 | 8 |
|
| 9 | 9 |
"github.com/docker/distribution/reference" |
| 10 | 10 |
"github.com/docker/distribution/registry/client/auth" |
| 11 |
- "github.com/docker/docker/cliconfig" |
|
| 12 | 11 |
) |
| 13 | 12 |
|
| 14 | 13 |
// Service is a registry service. It tracks configuration data such as a list |
| ... | ... |
@@ -28,7 +27,7 @@ func NewService(options *Options) *Service {
|
| 28 | 28 |
// Auth contacts the public registry with the provided credentials, |
| 29 | 29 |
// and returns OK if authentication was successful. |
| 30 | 30 |
// It can be used to verify the validity of a client's credentials. |
| 31 |
-func (s *Service) Auth(authConfig *cliconfig.AuthConfig) (string, error) {
|
|
| 31 |
+func (s *Service) Auth(authConfig *types.AuthConfig) (string, error) {
|
|
| 32 | 32 |
addr := authConfig.ServerAddress |
| 33 | 33 |
if addr == "" {
|
| 34 | 34 |
// Use the official registry address if not specified. |
| ... | ... |
@@ -72,7 +71,7 @@ func splitReposSearchTerm(reposName string) (string, string) {
|
| 72 | 72 |
|
| 73 | 73 |
// Search queries the public registry for images matching the specified |
| 74 | 74 |
// search terms, and returns the results. |
| 75 |
-func (s *Service) Search(term string, authConfig *cliconfig.AuthConfig, headers map[string][]string) (*SearchResults, error) {
|
|
| 75 |
+func (s *Service) Search(term string, authConfig *types.AuthConfig, headers map[string][]string) (*SearchResults, error) {
|
|
| 76 | 76 |
if err := validateNoSchema(term); err != nil {
|
| 77 | 77 |
return nil, err |
| 78 | 78 |
} |
| ... | ... |
@@ -20,7 +20,6 @@ import ( |
| 20 | 20 |
|
| 21 | 21 |
"github.com/Sirupsen/logrus" |
| 22 | 22 |
"github.com/docker/distribution/reference" |
| 23 |
- "github.com/docker/docker/cliconfig" |
|
| 24 | 23 |
"github.com/docker/docker/pkg/httputils" |
| 25 | 24 |
"github.com/docker/docker/pkg/ioutils" |
| 26 | 25 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -39,13 +38,13 @@ type Session struct {
|
| 39 | 39 |
indexEndpoint *Endpoint |
| 40 | 40 |
client *http.Client |
| 41 | 41 |
// TODO(tiborvass): remove authConfig |
| 42 |
- authConfig *cliconfig.AuthConfig |
|
| 42 |
+ authConfig *types.AuthConfig |
|
| 43 | 43 |
id string |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
type authTransport struct {
|
| 47 | 47 |
http.RoundTripper |
| 48 |
- *cliconfig.AuthConfig |
|
| 48 |
+ *types.AuthConfig |
|
| 49 | 49 |
|
| 50 | 50 |
alwaysSetBasicAuth bool |
| 51 | 51 |
token []string |
| ... | ... |
@@ -67,7 +66,7 @@ type authTransport struct {
|
| 67 | 67 |
// If the server sends a token without the client having requested it, it is ignored. |
| 68 | 68 |
// |
| 69 | 69 |
// This RoundTripper also has a CancelRequest method important for correct timeout handling. |
| 70 |
-func AuthTransport(base http.RoundTripper, authConfig *cliconfig.AuthConfig, alwaysSetBasicAuth bool) http.RoundTripper {
|
|
| 70 |
+func AuthTransport(base http.RoundTripper, authConfig *types.AuthConfig, alwaysSetBasicAuth bool) http.RoundTripper {
|
|
| 71 | 71 |
if base == nil {
|
| 72 | 72 |
base = http.DefaultTransport |
| 73 | 73 |
} |
| ... | ... |
@@ -162,7 +161,7 @@ func (tr *authTransport) CancelRequest(req *http.Request) {
|
| 162 | 162 |
|
| 163 | 163 |
// NewSession creates a new session |
| 164 | 164 |
// TODO(tiborvass): remove authConfig param once registry client v2 is vendored |
| 165 |
-func NewSession(client *http.Client, authConfig *cliconfig.AuthConfig, endpoint *Endpoint) (r *Session, err error) {
|
|
| 165 |
+func NewSession(client *http.Client, authConfig *types.AuthConfig, endpoint *Endpoint) (r *Session, err error) {
|
|
| 166 | 166 |
r = &Session{
|
| 167 | 167 |
authConfig: authConfig, |
| 168 | 168 |
client: client, |
| ... | ... |
@@ -743,12 +742,12 @@ func (r *Session) SearchRepositories(term string) (*SearchResults, error) {
|
| 743 | 743 |
|
| 744 | 744 |
// GetAuthConfig returns the authentication settings for a session |
| 745 | 745 |
// TODO(tiborvass): remove this once registry client v2 is vendored |
| 746 |
-func (r *Session) GetAuthConfig(withPasswd bool) *cliconfig.AuthConfig {
|
|
| 746 |
+func (r *Session) GetAuthConfig(withPasswd bool) *types.AuthConfig {
|
|
| 747 | 747 |
password := "" |
| 748 | 748 |
if withPasswd {
|
| 749 | 749 |
password = r.authConfig.Password |
| 750 | 750 |
} |
| 751 |
- return &cliconfig.AuthConfig{
|
|
| 751 |
+ return &types.AuthConfig{
|
|
| 752 | 752 |
Username: r.authConfig.Username, |
| 753 | 753 |
Password: password, |
| 754 | 754 |
Email: r.authConfig.Email, |