Files
Gardomatic/internal/web/context.go
T
kleiax 904d14b64c
CI / test (push) Canceled after 0s
Initial commit
2026-09-12 22:22:17 +02:00

20 lines
350 B
Go

package web
import (
"context"
"gardomatic.kleiax.de/lib/client"
)
type contextKey string
const (
isAuthenticatedContextKey = contextKey("isAuthenticated")
userContextKey = contextKey("user")
)
func userFromContext(ctx context.Context) (client.User, bool) {
user, ok := ctx.Value(userContextKey).(client.User)
return user, ok
}