fix context problems
This commit is contained in:
@@ -10,7 +10,7 @@ type authkey int
|
||||
const keyClaims = iota
|
||||
|
||||
func writeToContext(r *http.Request, claims *Claims) *http.Request {
|
||||
ctx := context.WithValue(r.Context(), claims, claims)
|
||||
ctx := context.WithValue(r.Context(), keyClaims, claims)
|
||||
return r.WithContext(ctx)
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,7 @@ func (s *Service) Authenticated(next http.HandlerFunc, roles ...model.Role) http
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
r = writeToContext(r, &claims)
|
||||
next(w, r)
|
||||
})
|
||||
|
Reference in New Issue
Block a user