jupyterhub / binderhub

Run your code in the cloud, with technology so advanced, it feels like magic!
https://binderhub.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.57k stars 390 forks source link

Add compatibility for fetching tokens from other Docker registries #1586

Closed manics closed 1 year ago

manics commented 1 year ago

The current DockerRegistry class only works with docker.io and gcr.io, as the token endpoints are hardcoded: https://github.com/jupyterhub/binderhub/blob/fb773a0891d0ed84ad397ec4eeabec7b79e2947b/binderhub/registry.py#L126-L136

Support for other registries can be added be parsing a WWW-Authentication: Bearer header if there's one to obtain the token endpoint, e.g. WWW-Authenticate: Bearer realm="https://uk-london-1.ocir.io/12345678/docker/token",service="uk-london-1.ocir.io",scope=""

This has been tested with Oracle Cloud Infrastructure Container Registry