summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-09-15 19:12:31 +0200
committerMatej Vasek <mvasek@redhat.com>2021-09-15 20:01:02 +0200
commit7c5d64b4783c2bf05587b3a4672b35c1e32066c7 (patch)
tree35d8e645c0bf2b4c10b2c2f0d79db894ea6a51a5 /pkg/api/handlers/compat
parentc0cde378298bd8d5183155c8f62aae574be069eb (diff)
downloadpodman-7c5d64b4783c2bf05587b3a4672b35c1e32066c7.tar.gz
podman-7c5d64b4783c2bf05587b3a4672b35c1e32066c7.tar.bz2
podman-7c5d64b4783c2bf05587b3a4672b35c1e32066c7.zip
Fix /auth compat endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r--pkg/api/handlers/compat/auth.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/auth.go b/pkg/api/handlers/compat/auth.go
index 2244adc3d..cf53e060c 100644
--- a/pkg/api/handlers/compat/auth.go
+++ b/pkg/api/handlers/compat/auth.go
@@ -50,9 +50,19 @@ func Auth(w http.ResponseWriter, r *http.Request) {
Status: "Login Succeeded",
})
} else {
- utils.WriteResponse(w, http.StatusBadRequest, entities.AuthReport{
- IdentityToken: "",
- Status: "login attempt to " + authConfig.ServerAddress + " failed with status: " + err.Error(),
+ var msg string
+
+ var unauthErr DockerClient.ErrUnauthorizedForCredentials
+ if errors.As(err, &unauthErr) {
+ msg = "401 Unauthorized"
+ } else {
+ msg = err.Error()
+ }
+
+ utils.WriteResponse(w, http.StatusInternalServerError, struct {
+ Message string `json:"message"`
+ }{
+ Message: "login attempt to " + authConfig.ServerAddress + " failed with status: " + msg,
})
}
}