package auth import ( "context" "git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq" ) type ctxKey int const userCtxKey ctxKey = 1 // UserFromContext returns the authenticated user placed in context by // RequireUser. Returns false when RequireUser has not run (e.g. in tests that // bypass the middleware, or programmer-error routing). func UserFromContext(ctx context.Context) (dbq.User, bool) { u, ok := ctx.Value(userCtxKey).(dbq.User) return u, ok }