summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-24 14:35:10 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-06-25 09:56:21 +0200
commitf95b0995e521e252af52edaf57a31241d364e3d8 (patch)
tree438f53d11703722c6712cf1b84c9fe1efdc884d0 /pkg/api/handlers/compat
parentd1f57a07c24a0defc0b0027206fc4454307f64fa (diff)
downloadpodman-f95b0995e521e252af52edaf57a31241d364e3d8.tar.gz
podman-f95b0995e521e252af52edaf57a31241d364e3d8.tar.bz2
podman-f95b0995e521e252af52edaf57a31241d364e3d8.zip
remove `pkg/registries`
Pull the trigger on the `pkg/registries` package which acted as a proxy for `c/image/pkg/sysregistriesv2`. Callers should be using the packages from c/image directly, if needed at all. Also make use of libimage's SystemContext() method which returns a copy of a system context, further reducing the risk of unintentionally altering global data. [NO TESTS NEEDED] Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r--pkg/api/handlers/compat/auth.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/pkg/api/handlers/compat/auth.go b/pkg/api/handlers/compat/auth.go
index 2c152fbc2..3594c9781 100644
--- a/pkg/api/handlers/compat/auth.go
+++ b/pkg/api/handlers/compat/auth.go
@@ -9,9 +9,9 @@ import (
DockerClient "github.com/containers/image/v5/docker"
"github.com/containers/image/v5/types"
+ "github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/pkg/api/handlers/utils"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/containers/podman/v3/pkg/registries"
docker "github.com/docker/docker/api/types"
"github.com/pkg/errors"
)
@@ -37,15 +37,13 @@ func Auth(w http.ResponseWriter, r *http.Request) {
skipTLS = types.NewOptionalBool(true)
}
+ runtime := r.Context().Value("runtime").(*libpod.Runtime)
+ sysCtx := runtime.SystemContext()
+ sysCtx.DockerInsecureSkipTLSVerify = skipTLS
+
fmt.Println("Authenticating with existing credentials...")
- sysCtx := types.SystemContext{
- AuthFilePath: "",
- DockerCertPath: "",
- DockerInsecureSkipTLSVerify: skipTLS,
- SystemRegistriesConfPath: registries.SystemRegistriesConfPath(),
- }
registry := stripAddressOfScheme(authConfig.ServerAddress)
- if err := DockerClient.CheckAuth(context.Background(), &sysCtx, authConfig.Username, authConfig.Password, registry); err == nil {
+ if err := DockerClient.CheckAuth(context.Background(), sysCtx, authConfig.Username, authConfig.Password, registry); err == nil {
utils.WriteResponse(w, http.StatusOK, entities.AuthReport{
IdentityToken: "",
Status: "Login Succeeded",