I created a program that works like a subset of
curl, but optionally will follow the bearer auth, so a single request against v2 registry will do the right thing.
I was doing a lot of work against the v2 registry. I love how the bearer auth works, but actually testing it was a pain.
curl to the registry, read the
curl to the auth server, read the token,
curl to the registry again, this time with a token.
curl -I http://some.registry.com
- Read the
www-authenticateheader from the above to get the
curl -I --user username:pass http://realm.server.from.number2.com
- Read the token from the JSON body
curl -H 'Authorize: Bearer <token> http://some.registry.com
curl --realm-user username:pass http://some.registry.com
Anyone dealing with token-based authentication registries should find this much easier to work with. Also tested against official docker hub. Hope it helps. Built in go, so single binary. Cross-compiled to mac and linux. MIT license.
Always happy to get feedback and PRs. Please cross-post to others who would find it useful.