Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The previous system is difficult to configure, with several SystemContext properties feeding the auth-getting logic. It also assumed that there was either a single username/password (DockerAuthConfig) or that the auth information was on disk somewhere. With this commit, I'm pushing all of the complexity down into a user-supplied getter (falling back to the old logic if the getter is unset). That makes it easy to plug in your own alternative without worrying about the default logic. The Docker-config AuthStore has a public Config property to make it easy for callers to drop in their own configuration for read-only access without having to go through either the filesystem or JSON. I've made the backing types public to support that use-case, and set custom JSON serialization for the newly-public Auth structure to allow Go callers to avoid having to understand the base64 wrapping used in the JSON serialization. I've also shifted a number of auth-getting unit tests from docker_client_test.go into config_test.go, since they only excercise config.go logic. Ideally the auth interface would support challenge/response auth like [1], but for now it just uses Docker's "we'll be able to hard-code authorization for each authority" approach. URI authorities are specified in [2]. [1]: https://tools.ietf.org/html/rfc7235 [2]: https://tools.ietf.org/html/rfc3986#section-3.2 Signed-off-by: W. Trevor King <[email protected]>
- Loading branch information