From d9fcf713ca29c9e7aace183914e9df2ebdf865b2 Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani Date: Thu, 30 Jan 2020 23:57:03 -0800 Subject: [PATCH] auth: compliance requires error codes be returned a certain way use the new NewErrorList() method and the enum constants as strings --- pkg/api/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/auth.go b/pkg/api/auth.go index d265e39d..bc9a44ac 100644 --- a/pkg/api/auth.go +++ b/pkg/api/auth.go @@ -58,7 +58,7 @@ func bearerAuthHandler(c *Controller) mux.MiddlewareFunc { if err != nil { c.Log.Error().Err(err).Msg("issue parsing Authorization header") w.Header().Set("Content-Type", "application/json") - WriteJSON(w, http.StatusInternalServerError, NewError(UNSUPPORTED)) + WriteJSON(w, http.StatusInternalServerError, NewErrorList(NewError(UNSUPPORTED))) return } if !permissions.Allowed { @@ -218,5 +218,5 @@ func authFail(w http.ResponseWriter, realm string, delay int) { time.Sleep(time.Duration(delay) * time.Second) w.Header().Set("WWW-Authenticate", realm) w.Header().Set("Content-Type", "application/json") - WriteJSON(w, http.StatusUnauthorized, NewError(UNAUTHORIZED)) + WriteJSON(w, http.StatusUnauthorized, NewErrorList(NewError(UNAUTHORIZED))) }