Returns the authentication data from the given auth configuration for a specific registry. As with the Docker client, legacy entries in the config with full URLs are stripped down to hostnames before checking for a match. Returns None if no match was found.
(self, registry=None)
| 207 | ) |
| 208 | |
| 209 | def resolve_authconfig(self, registry=None): |
| 210 | """ |
| 211 | Returns the authentication data from the given auth configuration for a |
| 212 | specific registry. As with the Docker client, legacy entries in the |
| 213 | config with full URLs are stripped down to hostnames before checking |
| 214 | for a match. Returns None if no match was found. |
| 215 | """ |
| 216 | |
| 217 | if self.creds_store or self.cred_helpers: |
| 218 | store_name = self.get_credential_store(registry) |
| 219 | if store_name is not None: |
| 220 | log.debug( |
| 221 | f'Using credentials store "{store_name}"' |
| 222 | ) |
| 223 | cfg = self._resolve_authconfig_credstore(registry, store_name) |
| 224 | if cfg is not None: |
| 225 | return cfg |
| 226 | log.debug('No entry in credstore - fetching from auth dict') |
| 227 | |
| 228 | # Default to the public index server |
| 229 | registry = resolve_index_name(registry) if registry else INDEX_NAME |
| 230 | log.debug(f"Looking for auth entry for {repr(registry)}") |
| 231 | |
| 232 | if registry in self.auths: |
| 233 | log.debug(f"Found {repr(registry)}") |
| 234 | return self.auths[registry] |
| 235 | |
| 236 | for key, conf in self.auths.items(): |
| 237 | if resolve_index_name(key) == registry: |
| 238 | log.debug(f"Found {repr(key)}") |
| 239 | return conf |
| 240 | |
| 241 | log.debug("No entry found") |
| 242 | return None |
| 243 | |
| 244 | def _resolve_authconfig_credstore(self, registry, credstore_name): |
| 245 | if not registry or registry == INDEX_NAME: |