diff options
author | Matej Vasek <mvasek@redhat.com> | 2021-09-15 19:12:31 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-09-22 15:39:01 -0400 |
commit | 1a25a90a4ec01fb254b617a8350683cbf28c6ca5 (patch) | |
tree | ce379c915cf9322251e7e91878177944edf19ba3 /pkg/api | |
parent | c8fd65ea6aa8f8e252a52b1c2cc32dae2a9434d5 (diff) | |
download | podman-1a25a90a4ec01fb254b617a8350683cbf28c6ca5.tar.gz podman-1a25a90a4ec01fb254b617a8350683cbf28c6ca5.tar.bz2 podman-1a25a90a4ec01fb254b617a8350683cbf28c6ca5.zip |
Fix /auth compat endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/compat/auth.go | 16 |
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, }) } } |