Skip to content

Commit

Permalink
unify auth (#338)
Browse files Browse the repository at this point in the history
Signed-off-by: Shiwei Zhang <[email protected]>
  • Loading branch information
shizhMSFT authored Nov 11, 2021
1 parent ce63e04 commit 58fa344
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cmd/oras/resolver.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"crypto/tls"
"fmt"
"net/http"
Expand Down Expand Up @@ -52,10 +51,7 @@ func newResolver(username, password string, insecure bool, plainHTTP bool, confi
if err != nil {
fmt.Fprintf(os.Stderr, "WARNING: Error loading auth file: %v\n", err)
}
resolver, err := cli.Resolver(context.Background(), client, plainHTTP)
if err != nil {
fmt.Fprintf(os.Stderr, "WARNING: Error loading resolver: %v\n", err)
resolver = docker.NewResolver(*opts)
}
return resolver, opts
dockerCli := cli.(*auth.Client)
opts.Credentials = dockerCli.Credential
return docker.NewResolver(*opts), opts
}

0 comments on commit 58fa344

Please sign in to comment.