adigunhammedolalekan / registry-auth

a package to implement private docker registry token authentication server
MIT License
22 stars 10 forks source link

can't use the docker registry REST API #3

Open maximrub opened 4 years ago

maximrub commented 4 years ago

Hello, I'm using this package with my private docker registry. When using it for docker login, pull and push via bash everything works. I'm trying to use the docker registry REST API via postman to list all images but it files on authentication

List all repositories (effectively images): curl -X GET https://myregistry:5000/v2/_catalog -u user:password

List all tags for a repository: curl -X GET https://myregistry:5000/v2/ubuntu/tags/list -u user:password

I added logs and set breakpoints in the ServeHTTP function in server.go when using docker login, push and pull it reaches the ServeHTTP function, but when I'm using the REST API the ServeHTTP function doesn't get called and I receive the following error

{ "errors": [ { "code": "UNAUTHORIZED", "message": "authentication required", "detail": [ { "Type": "registry", "Class": "", "Name": "catalog", "Action": "*" } ] } ] }

I gave my user "*" as allowed actions but it doesn't solves it

rajasekharmullangi commented 2 years ago

Hi maximrub,

I am also facing same issue. Did you got any solution for this problem

Thanks & Regards, Rajasekhar Reddy Mullangi.

rubens21 commented 2 years ago

Guys, this problem is likely caused by the issue explained on this PR comments: https://github.com/adigunhammedolalekan/registry-auth/pull/4

The library relies on a parameter to identify the account name. But that parameter is not in the Docker registry documentation. I only works when we use the Docker cli client.

If you guys add the parameter &account=[your account name], than your Authorize method will receive the correct account name.