Skip to content

Commit eb3124f

Browse files
committed
Clarify legacy mode
Signed-off-by: Terry Howe <[email protected]>
1 parent d5b9870 commit eb3124f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

registry/remote/auth/client.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,17 @@ type Client struct {
125125
// instead of OAuth2 with password grant when authenticating using
126126
// username and password.
127127
// Default is false (OAuth2 is used).
128+
//
129+
// When legacyMode is true, the client uses the legacy distribution spec for
130+
// authentication. If the registry says it supports bearer authentication,
131+
// basic authentication will be performed unless there are no credentials
132+
// or a refresh token is provided. This is the approach used in oras-go
133+
// v1 and v2.
134+
//
135+
// When legacyMode is false (default), the client uses OAuth2 with password
136+
// grant. If the registry says it supports bearer authentication, bearer
137+
// authentication will be performed.
138+
//
128139
// References:
129140
// - https://distribution.github.io/distribution/spec/auth/jwt/
130141
// - https://distribution.github.io/distribution/spec/auth/oauth/
@@ -178,8 +189,14 @@ func (c *Client) SetUserAgent(userAgent string) {
178189
// and password.
179190
//
180191
// When legacy is true, the client uses the legacy distribution spec for
181-
// authentication. When legacy is false (default), the client uses OAuth2
182-
// with password grant.
192+
// authentication. If the registry says it supports bearer authentication,
193+
// basic authentication will be performed unless there are no credentials
194+
// or a refresh token is provided. This is the approach used in oras-go
195+
// v1 and v2.
196+
//
197+
// When legacy is false (default), the client uses OAuth2 with password
198+
// grant. If the registry says it supports bearer authentication, bearer
199+
// authentication will be performed.
183200
//
184201
// References:
185202
// - https://distribution.github.io/distribution/spec/auth/jwt/

0 commit comments

Comments
 (0)