MCPcopy
hub / github.com/docker/docker-py / _resolve_authconfig_credstore

Method _resolve_authconfig_credstore

docker/auth.py:244–270  ·  view source on GitHub ↗
(self, registry, credstore_name)

Source from the content-addressed store, hash-verified

242 return None
243
244 def _resolve_authconfig_credstore(self, registry, credstore_name):
245 if not registry or registry == INDEX_NAME:
246 # The ecosystem is a little schizophrenic with index.docker.io VS
247 # docker.io - in that case, it seems the full URL is necessary.
248 registry = INDEX_URL
249 log.debug(f"Looking for auth entry for {repr(registry)}")
250 store = self._get_store_instance(credstore_name)
251 try:
252 data = store.get(registry)
253 res = {
254 'ServerAddress': registry,
255 }
256 if data['Username'] == TOKEN_USERNAME:
257 res['IdentityToken'] = data['Secret']
258 else:
259 res.update({
260 'Username': data['Username'],
261 'Password': data['Secret'],
262 })
263 return res
264 except credentials.CredentialsNotFound:
265 log.debug('No entry found')
266 return None
267 except credentials.StoreError as e:
268 raise errors.DockerException(
269 f'Credentials store error: {repr(e)}'
270 ) from e
271
272 def _get_store_instance(self, name):
273 if name not in self._stores:

Callers 2

resolve_authconfigMethod · 0.95
get_all_credentialsMethod · 0.95

Calls 3

_get_store_instanceMethod · 0.95
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected