mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
auth: compliance requires error codes be returned a certain way
use the new NewErrorList() method and the enum constants as strings
This commit is contained in:
parent
909a97b922
commit
d9fcf713ca
1 changed files with 2 additions and 2 deletions
|
@ -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)))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue