mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-31 10:43:10 -06:00
Update httpapi.go
This commit is contained in:
parent
1e41383d04
commit
d707d3ebc8
|
|
@ -53,13 +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 {
|
||||||
util.GetLogger((req.Context())).Debugf("VerifyUserFromRequest %s -> HTTP %d", req.RemoteAddr, err.Code)
|
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