summaryrefslogtreecommitdiff
path: root/pkg/web
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-02-24 18:53:18 +0100
committerkali kaneko (leap communications) <kali@leap.se>2020-02-24 18:56:32 +0100
commita0bc2768c04255e13ef87798d87e4916d7bf17fc (patch)
tree90e69481cbd2d5da43e536c46f2bd9b6a672e738 /pkg/web
parent06cbe623a7aa6576e4d24fefd056b13d2b0f35cf (diff)
[tests] return auth errors
and add unit tests for message parsing
Diffstat (limited to 'pkg/web')
-rw-r--r--pkg/web/middleware.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/web/middleware.go b/pkg/web/middleware.go
index ed137d6..3ff8938 100644
--- a/pkg/web/middleware.go
+++ b/pkg/web/middleware.go
@@ -64,14 +64,14 @@ func AuthMiddleware(authenticationFunc func(*creds.Credentials) (bool, error), o
if err != nil {
metrics.UnavailableLogins.Inc()
log.Println("Error while checking credentials: ", err)
- http.Error(w, "Auth service unavailable", http.StatusServiceUnavailable)
+ http.Error(w, "503: Auth service unavailable", http.StatusServiceUnavailable)
return
} else {
metrics.FailedLogins.Inc()
if isDebugAuthEnabled(debugFlag) {
log.Println("Wrong credentials for user", c.User)
}
- http.Error(w, "Wrong user and/or password", http.StatusUnauthorized)
+ http.Error(w, "401: Wrong user and/or password", http.StatusUnauthorized)
return
}
}