aboutsummaryrefslogtreecommitdiffhomepage
path: root/middleware/basic_auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/basic_auth.go')
-rw-r--r--middleware/basic_auth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/middleware/basic_auth.go b/middleware/basic_auth.go
index 5a7204c..c897beb 100644
--- a/middleware/basic_auth.go
+++ b/middleware/basic_auth.go
@@ -22,26 +22,26 @@ func (m *Middleware) BasicAuth(next http.Handler) http.Handler {
username, password, authOK := r.BasicAuth()
if !authOK {
logger.Debug("[Middleware:BasicAuth] No authentication headers sent")
- json.Unauthorized(w)
+ json.Unauthorized(w, r)
return
}
if err := m.store.CheckPassword(username, password); err != nil {
logger.Error("[Middleware:BasicAuth] [ClientIP=%s] Invalid username or password: %s", clientIP, username)
- json.Unauthorized(w)
+ json.Unauthorized(w, r)
return
}
user, err := m.store.UserByUsername(username)
if err != nil {
logger.Error("[Middleware:BasicAuth] %v", err)
- json.ServerError(w, err)
+ json.ServerError(w, r, err)
return
}
if user == nil {
logger.Error("[Middleware:BasicAuth] [ClientIP=%s] User not found: %s", clientIP, username)
- json.Unauthorized(w)
+ json.Unauthorized(w, r)
return
}