From 14220d9833c95d4f40c774197c97fd8108d10ea6 Mon Sep 17 00:00:00 2001 From: Patrick Devine Date: Wed, 16 Aug 2023 21:42:02 -0700 Subject: [PATCH] set the scopes correctly (#368) --- server/auth.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/auth.go b/server/auth.go index edf7865b..87b1194b 100644 --- a/server/auth.go +++ b/server/auth.go @@ -48,7 +48,12 @@ func (r AuthRedirect) URL() (string, error) { if err != nil { return "", err } - return fmt.Sprintf("%s?service=%s&scope=%s&ts=%d&nonce=%s", r.Realm, r.Service, r.Scope, time.Now().Unix(), nonce), nil + scopes := []string{} + for _, s := range strings.Split(r.Scope, " ") { + scopes = append(scopes, fmt.Sprintf("scope=%s", s)) + } + scopeStr := strings.Join(scopes, "&") + return fmt.Sprintf("%s?service=%s&%s&ts=%d&nonce=%s", r.Realm, r.Service, scopeStr, time.Now().Unix(), nonce), nil } func getAuthToken(ctx context.Context, redirData AuthRedirect, regOpts *RegistryOptions) (string, error) {