Documentation
¶
Overview ¶
Package auth contains helpers for managing identities within the GraphQL API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotAuthenticated = errors.New("not authenticated or read-only")
ErrNotAuthenticated is returned to the client if the user requests an action requiring authentication, and they are not authenticated.
Functions ¶
func CtxWithUser ¶
CtxWithUser attaches an Identity to a context.
func RequireAuth ¶ added in v0.11.0
RequireAuth rejects requests that carry no identity in context with 403. Use it to guard write endpoints so that when the auth middleware is replaced with session-based auth, unauthenticated requests are blocked at the route level.
func UserFromCtx ¶
UserFromCtx retrieves an IdentityCache from the context. If there is no identity in the context, ErrNotAuthenticated is returned. If an error occurs while resolving the identity (e.g. I/O error), then it will be returned.
Types ¶
This section is empty.