summaryrefslogtreecommitdiff
path: root/docker/auth/auth.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-09-13 17:24:02 -0700
committerJoffrey F <joffrey@docker.com>2016-09-15 14:28:09 -0700
commitd731a4315c44974954eef503fd23c512b912296d (patch)
tree435667eb6982d4b4227eb4ae9e242b913f4cb38c /docker/auth/auth.py
parentbe7d0f01844d5c08ee157446ce96f5bc6381507c (diff)
downloaddocker-py-identity-token-support.tar.gz
Add support for identity tokens in config file.identity-token-support
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/auth/auth.py')
-rw-r--r--docker/auth/auth.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/docker/auth/auth.py b/docker/auth/auth.py
index ea15def..dc0baea 100644
--- a/docker/auth/auth.py
+++ b/docker/auth/auth.py
@@ -174,6 +174,15 @@ def parse_auth(entries, raise_on_error=False):
'Invalid configuration for registry {0}'.format(registry)
)
return {}
+ if 'identitytoken' in entry:
+ log.debug('Found an IdentityToken entry for registry {0}'.format(
+ registry
+ ))
+ conf[registry] = {
+ 'IdentityToken': entry['identitytoken']
+ }
+ continue # Other values are irrelevant if we have a token, skip.
+
if 'auth' not in entry:
# Starting with engine v1.11 (API 1.23), an empty dictionary is
# a valid value in the auths config.
@@ -182,13 +191,15 @@ def parse_auth(entries, raise_on_error=False):
'Auth data for {0} is absent. Client might be using a '
'credentials store instead.'
)
- return {}
+ conf[registry] = {}
+ continue
username, password = decode_auth(entry['auth'])
log.debug(
'Found entry (registry={0}, username={1})'
.format(repr(registry), repr(username))
)
+
conf[registry] = {
'username': username,
'password': password,