Skip to content

Commit 63c14dc

Browse files
committed
update doc
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
1 parent 4d11669 commit 63c14dc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

registry/remote/auth/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func (c *Client) Do(originalReq *http.Request) (*http.Response, error) {
187187
req.Header.Set("Authorization", "Basic "+token)
188188
}
189189
case SchemeBearer:
190-
// merge per-host scopes with generic scopes
190+
// merge per-host scopes with global scopes
191191
scopes := GetScopesForHost(ctx, host)
192192
if moreScopes := GetScopes(ctx); len(moreScopes) > 0 {
193193
scopes = append(scopes, moreScopes...)
@@ -231,7 +231,7 @@ func (c *Client) Do(originalReq *http.Request) (*http.Response, error) {
231231
scopes := GetScopesForHost(ctx, host)
232232
cleanScopeLen := len(scopes)
233233
if moreScopes := GetScopes(ctx); len(moreScopes) > 0 {
234-
// merge per-host scopes with generic scopes
234+
// merge per-host scopes with global scopes
235235
scopes = append(scopes, moreScopes...)
236236
}
237237
if paramScope := params["scope"]; paramScope != "" {

registry/remote/auth/scope.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ func AppendScopesForHost(ctx context.Context, host string, scopes ...string) con
162162
return WithScopesForHost(ctx, host, append(oldScopes, scopes...)...)
163163
}
164164

165-
// GetScopesForHost returns the scopes in the context for the given host.
165+
// GetScopesForHost returns the scopes in the context for the given host,
166+
// excluding the global scopes added by [WithScopes] and [AppendScopes].
166167
func GetScopesForHost(ctx context.Context, host string) []string {
167168
if scopes, ok := ctx.Value(scopesForHostContextKey(host)).([]string); ok {
168169
return slices.Clone(scopes)

0 commit comments

Comments
 (0)