WithScope appends a custom registry auth scope to the context.
(ctx context.Context, scope string)
| 56 | |
| 57 | // WithScope appends a custom registry auth scope to the context. |
| 58 | func WithScope(ctx context.Context, scope string) context.Context { |
| 59 | var scopes []string |
| 60 | if v := ctx.Value(tokenScopesKey{}); v != nil { |
| 61 | scopes = v.([]string) |
| 62 | scopes = append(scopes, scope) |
| 63 | } else { |
| 64 | scopes = []string{scope} |
| 65 | } |
| 66 | return context.WithValue(ctx, tokenScopesKey{}, scopes) |
| 67 | } |
| 68 | |
| 69 | // ContextWithAppendPullRepositoryScope is used to append repository pull |
| 70 | // scope into existing scopes indexed by the tokenScopesKey{}. |
no outgoing calls
searching dependent graphs…