20 lines
350 B
Go
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
|
|
}
|