Merge pull request #46 from safing/fix/api-auth-error

Fix and improve api authentication error
This commit is contained in:
Patrick Pacher 2020-05-22 09:40:59 +02:00 committed by GitHub
commit 51a47067bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,7 +82,8 @@ func authMiddleware(next http.Handler) http.Handler {
grantAccess, err := authenticator(server, r) grantAccess, err := authenticator(server, r)
if err != nil { if err != nil {
log.Warningf("api: authenticator failed: %s", err) log.Warningf("api: authenticator failed: %s", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError) http.Error(w, "Bad Request: Could not identify client", http.StatusBadRequest)
return
} }
if !grantAccess { if !grantAccess {
log.Warningf("api: denying api access to %s", r.RemoteAddr) log.Warningf("api: denying api access to %s", r.RemoteAddr)