Commit Graph

17 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
f0ce2f6d36
remotes/docker: remove deprecated NewAuthorizer alias
This was deprecated since containerd v1.3.0.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-20 22:27:21 +01:00
ye.sijun
c0e00f19ab fix acr fetch token 400
Signed-off-by: ye.sijun <junnplus@gmail.com>
2022-01-27 17:34:45 +08:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
Akihiro Suda
97623ab0cd
remotes/docker: allow fetching "refresh token" (aka "identity token")
The new AuthorizerOpt `WithFetchRefreshToken` allows fetching "refresh token"
(aka "identity token", "offline token").

For HTTP GET mode (`FetchToken`), `offline_token=true` is set in the request.
https://docs.docker.com/registry/spec/auth/token/#requesting-a-token

For HTTP POST mode (`FetchTokenWithOAuth`), `access_type=offline` is set in the request.
https://docs.docker.com/registry/spec/auth/oauth/#getting-a-token

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-12-27 15:19:45 +09:00
Ilya Dmitrichenko
2de55060ee
Log unexpected responses
This accomplishes a few long-standing TODO items, but also helps users
in showing exact registry error messages

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2020-09-03 14:52:11 +01:00
Tonis Tiigi
b5185eae6c auth: return token structs from fetcher functions
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-08-04 12:59:06 -07:00
Tonis Tiigi
957bcb3dff docker: split private token helper functions to reusable pkg
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-08-02 22:50:46 -07:00
Tonis Tiigi
03b5a053ea remotes: mark GetTokenScopes public
Authorizer interface can’t be really implemented because
scopes are passed in on a side channel via private value in context.


Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-29 23:01:36 -07:00
Derek McGowan
08517e5864
Allow empty scope authorization
Registries may allow using token authorization without
explicitly setting the scope. This may cover use cases where
no scope is required for an endpoint or the registry is only
covering authentication using the token. This aligns with the
oauth2 spec which specifies the scope as optional.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-12-12 11:05:48 -08:00
Jintao Zhang
4b4ce4a26c remotes: remove unnecessary string formatting
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2019-08-05 02:16:57 +08:00
Derek McGowan
0b29c9c371
Update resolver to handle endpoint configuration
Adds support for registry mirrors
Adds support for multiple pull endpoints
Adds capabilities to limit trust in public mirrors
Fixes user agent header missing


Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-16 11:28:23 -07:00
Wei Fu
dd7c0aabcc remotes: support cross-repo-push
With distribution source label in content store, select the longest
common prefix components as condidate mount blob source and try to push
with mount blob.

Fix #2964

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-06-13 09:51:46 +08:00
Derek McGowan
bb00872800
Add user agent header to all requests
Currently the user agent is only being used on the initial
resolve request, then switching to the default user agent.
This ensures the correct user agent is always used. There is
a larger fix in progress which does this is a cleaner way, but
the scope of this change is fixing the user agent issue.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-06-11 22:57:58 +08:00
Eric Lin
2db0c6c262 Explicitly stating utf-8 when fetching oauth token
Fixes #2870

Signed-off-by: Eric Lin <linxiulei@gmail.com>
2018-12-12 12:16:27 +08:00
Tonis Tiigi
a2e8ab9ff7 remotes: avoid panic with default resolver conf
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-11-19 17:33:59 -08:00
Gábor Lipták
4a0c40664a
Correct redundant nil check
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2018-10-19 16:50:17 -04:00
Derek McGowan
a6198b7692
Update resolver code
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-28 14:32:23 -07:00