@@ -156,26 +156,23 @@ func GetNotaryRepository(in io.Reader, out io.Writer, userAgent string, repoInfo
156156 }
157157 }
158158
159- scope := auth.RepositoryScope {
160- Repository : repoInfo .Name .Name (),
161- Actions : actions ,
162- }
163- creds := simpleCredentialStore {auth : * authConfig }
164159 tokenHandler := auth .NewTokenHandlerWithOptions (auth.TokenHandlerOptions {
165160 Transport : authTransport ,
166- Credentials : creds ,
167- Scopes : []auth.Scope {scope },
168- ClientID : registry .AuthClientID ,
161+ Credentials : simpleCredentialStore {auth : * authConfig },
162+ Scopes : []auth.Scope {auth.RepositoryScope {
163+ Repository : repoInfo .Name .Name (),
164+ Actions : actions ,
165+ }},
166+ ClientID : registry .AuthClientID ,
169167 })
170- basicHandler := auth .NewBasicHandler (creds )
168+ basicHandler := auth .NewBasicHandler (simpleCredentialStore { auth : * authConfig } )
171169 modifiers = append (modifiers , auth .NewAuthorizer (challengeManager , tokenHandler , basicHandler ))
172- tr := transport .NewTransport (base , modifiers ... )
173170
174171 return client .NewFileCachedRepository (
175172 GetTrustDirectory (),
176173 data .GUN (repoInfo .Name .Name ()),
177174 server ,
178- tr ,
175+ transport . NewTransport ( base , modifiers ... ) ,
179176 GetPassphraseRetriever (in , out ),
180177 trustpinning.TrustPinConfig {})
181178}
@@ -234,9 +231,9 @@ func NotaryError(repoName string, err error) error {
234231 return fmt .Errorf ("error: remote trust data does not exist for %s: %v" , repoName , err )
235232 case signed.ErrInsufficientSignatures :
236233 return fmt .Errorf ("error: could not produce valid signature for %s. If Yubikey was used, was touch input provided?: %v" , repoName , err )
234+ default :
235+ return err
237236 }
238-
239- return err
240237}
241238
242239// AddToAllSignableRoles attempts to add the image target to all the top level
@@ -346,9 +343,9 @@ func GetImageReferencesAndAuth(ctx context.Context,
346343
347344func getTag (ref reference.Named ) string {
348345 switch x := ref .(type ) {
349- case reference.Canonical , reference. Digested :
350- return ""
351- case reference.NamedTagged :
346+ case reference.Digested :
347+ return "" // TODO(thaJeztah): is it intentional to discard the tag when "Tagged+Digested"?
348+ case reference.Tagged :
352349 return x .Tag ()
353350 default :
354351 return ""
@@ -357,12 +354,10 @@ func getTag(ref reference.Named) string {
357354
358355func getDigest (ref reference.Named ) digest.Digest {
359356 switch x := ref .(type ) {
360- case reference.Canonical :
361- return x .Digest ()
362357 case reference.Digested :
363358 return x .Digest ()
364359 default :
365- return digest . Digest ( "" )
360+ return ""
366361 }
367362}
368363
0 commit comments