Commit Graph

28 Commits

Author SHA1 Message Date
David Calavera cf721c23e7 Client credentials store.
This change implements communication with an external credentials store,
ala git-credential-helper. The client falls back the plain text store,
what we're currently using, if there is no remote store configured.

It shells out to helper program when a credential store is
configured. Those programs can be implemented with any language as long as they
follow the convention to pass arguments and information.

There is an implementation for the OS X keychain in https://github.com/calavera/docker-credential-helpers.
That package also provides basic structure to create other helpers.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-29 13:01:31 -05:00
Arnaud Porterie 243d0d6bbe Remove unnecessary call to /info
Avoid using the `/info` endpoint in the `login` and `logout` workflows
when the Registry endpoint is overriden by the user through the command
line.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-02-03 13:10:25 -08:00
Arnaud Porterie 8ee7ad2209 Enable cross-platforms logout from Registry
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-02-03 10:32:22 -08:00
Arnaud Porterie 960710bd81 Enable cross-platforms login to Registry
Use a daemon-defined Registry URL for `docker login`. This allows a
Windows client interacting with a Linux daemon to properly use the
default Registry endpoint instead of the Windows specific one.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-02-01 11:18:54 -08:00
Liu Hua 755df347fb forbid login of a null-string username
With this patch, the client blocks this type login, no sending
useless messages to daemon and registry. This saves lots of time.

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
2016-01-29 22:39:22 +08:00
David Calavera 8ed06af044 Always prompt for a password when asking for credentials.
There is a weird behavior where we don't ask for a password
when the user you type in the prompt is the same you have configured
in the config file.

This is the source of many frustrations and also a bug.
If the authentication with a registry fails because the password
is incorrect, we won't ask for the password again with the current logic.

With this change, we also stop calling `CmdLogin` directly when
authentication fails. We don't need to parse flags from the cli or
setting up input destriptiors again, like the current behavior is doing.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-27 18:26:48 -05:00
David Calavera 907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
Daniel Nephin 96c10098ac Move IndexInfo and ServiceConfig types to api/types/registry/registry.go
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-12-14 11:28:02 -05:00
Daniel Nephin 5b321e3287 Move AuthConfig to api/types
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-12-14 11:22:01 -05:00
David Calavera b36531db60 Implement docker login with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:55 -05:00
John Howard 9c765040a5 Windows: Fix docker login
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-11-05 14:19:48 -08:00
Lei Jitang 2b0927c9ac Use consistent command description
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-10-08 08:46:21 -04:00
Hu Keping e9602f3561 Use TrimSpace to instead of Trim
String.Trim(string, " ") can only get ride of the blank, but actully we need
to remove all leading and trailing white space include "\t" for example.

Prior to this patch, one can login with "[Tab][Tab]username", and it will
not be consider as the same with "username".

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-09 19:37:33 +08:00
Aaron Lehmann 4fcb9ac40c Improve documentation and golint compliance of registry package
* Add godoc documentation where it was missing

* Change identifier names that don't match Go style, such as INDEX_NAME

* Rename RegistryInfo to PingResult, which more accurately describes
  what this structure is for. It also has the benefit of making the name
  not stutter if used outside the package.

Updates #14756

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-24 11:55:07 -07:00
Tibor Vass 96ce3a194a cli: new daemon command and new cli package
This patch creates a new cli package that allows to combine both client
and daemon commands (there is only one daemon command: docker daemon).

The `-d` and `--daemon` top-level flags are deprecated and a special
message is added to prompt the user to use `docker daemon`.

Providing top-level daemon-specific flags for client commands result
in an error message prompting the user to use `docker daemon`.

This patch does not break any old but correct usages.

This also makes `-d` and `--daemon` flags, as well as the `daemon`
command illegal in client-only binaries.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-23 19:44:46 -04:00
Derek McGowan 19515a7ad8 Update graph to use vendored distribution client for the v2 codepath
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-16 13:13:47 -04:00
John Howard 615681f517 Windows: Remove meaningless warnings on docker info
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-10 10:06:20 -07:00
Ma Shimiao 91a496055c api/client: close the returned io.ReadCloser
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-07-08 10:06:25 +08:00
Josh Hawn 86d6a5b11f Merge pull request #13869 from jlhawn/multi_line_help_usage
api/client: Allow for multi-line usage help
2015-06-15 14:50:17 -07:00
Josh Hawn 0cdc3b7539 api/client: have cli.call() return headers
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-06-10 16:20:13 -07:00
Josh Hawn 4cb0c93f92 api/client: Allow for multi-line usage help
Subcommands can provide multiple usage synopses.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-06-10 16:14:45 -07:00
Doug Davis bb9da6ba92 Move CLI config processing out from under registry dir
No logic changes should be in here, just moving things around.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-04-23 10:18:38 -07:00
Doug Davis 18c9b6c645 Add .docker/config.json and support for HTTP Headers
This PR does the following:
- migrated ~/.dockerfg to ~/.docker/config.json. The data is migrated
  but the old file remains in case its needed
- moves the auth json in that fie into an "auth" property so we can add new
  top-level properties w/o messing with the auth stuff
- adds support for an HttpHeaders property in ~/.docker/config.json
  which adds these http headers to all msgs from the cli

In a follow-on PR I'll move the config file process out from under
"registry" since it not specific to that any more. I didn't do it here
because I wanted the diff to be smaller so people can make sure I didn't
break/miss any auth code during my edits.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-04-20 13:05:24 -07:00
Antonio Murdaca 5670c6c695 Refactor utils/flags.go, fixes #11892
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-29 03:22:46 +02:00
Don Kjer 6b2eeaf896 Fix for issue 9922: private registry search with auth returns 401
Signed-off-by: Don Kjer <don.kjer@gmail.com>
2015-03-26 18:59:16 +00:00
Peggy Li b5d0380108 Add godoc-style docstrings to Cmd... methods
Signed-off-by: Peggy Li <peggyli.224@gmail.com>
2015-03-25 14:17:11 -07:00
Doug Davis 0d65069a17 Fix login
Right now it returns:
```
FATA[0001] json: Unmarshal(non-pointer types.AuthResponse)
```

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-03-25 08:45:14 -07:00
Joey Gibson 58690c9cca api/client - The code for all cli commands are in one file #11610
Signed-off-by: Joey Gibson <joey@joeygibson.com>
2015-03-24 23:57:23 -04:00