auth

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package auth contains helpers for managing identities within the GraphQL API.

Index

Constants

This section is empty.

Variables

View Source
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

func CtxWithUser(ctx context.Context, userId entity.Id) context.Context

CtxWithUser attaches an Identity to a context.

func Middleware

func Middleware(fixedUserId entity.Id) func(http.Handler) http.Handler

func UserFromCtx

func UserFromCtx(ctx context.Context, r *cache.RepoCache) (*cache.IdentityCache, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL