1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: write authenticated user to logs and sentry

This commit is contained in:
Ferdinand Mütsch
2021-03-26 13:10:10 +01:00
parent 01d51b78b1
commit 2b57da224c
17 changed files with 478 additions and 346 deletions

View File

@@ -1,7 +1,6 @@
package middlewares
import (
"context"
conf "github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/services"
@@ -65,8 +64,8 @@ func (m *AuthenticateMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Reques
return
}
ctx := context.WithValue(r.Context(), models.UserKey, user)
next(w, r.WithContext(ctx))
SetPrincipal(r, user)
next(w, r)
}
func (m *AuthenticateMiddleware) isOptional(requestPath string) bool {