mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Add debug logging for incoming CSAPI calls on authentication failure (#2116)
* Add debug logging for incoming CSAPI calls on authentication failure Will help to debug Complement failures, and just generally useful. * Update httpapi.go Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This commit is contained in:
parent
f034098877
commit
2ea5fd4162
1 changed files with 2 additions and 1 deletions
|
@ -53,12 +53,13 @@ func MakeAuthAPI(
|
||||||
f func(*http.Request, *userapi.Device) util.JSONResponse,
|
f func(*http.Request, *userapi.Device) util.JSONResponse,
|
||||||
) http.Handler {
|
) http.Handler {
|
||||||
h := func(req *http.Request) util.JSONResponse {
|
h := func(req *http.Request) util.JSONResponse {
|
||||||
|
logger := util.GetLogger(req.Context())
|
||||||
device, err := auth.VerifyUserFromRequest(req, userAPI)
|
device, err := auth.VerifyUserFromRequest(req, userAPI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logger.Debugf("VerifyUserFromRequest %s -> HTTP %d", req.RemoteAddr, err.Code)
|
||||||
return *err
|
return *err
|
||||||
}
|
}
|
||||||
// add the user ID to the logger
|
// add the user ID to the logger
|
||||||
logger := util.GetLogger((req.Context()))
|
|
||||||
logger = logger.WithField("user_id", device.UserID)
|
logger = logger.WithField("user_id", device.UserID)
|
||||||
req = req.WithContext(util.ContextWithLogger(req.Context(), logger))
|
req = req.WithContext(util.ContextWithLogger(req.Context(), logger))
|
||||||
// add the user to Sentry, if enabled
|
// add the user to Sentry, if enabled
|
||||||
|
|
Loading…
Reference in a new issue