git-bug: github.com/MichaelMure/git-bug/api/auth Index | Files

package auth

import "github.com/MichaelMure/git-bug/api/auth"

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

Index

Package Files

context.go errors.go middleware.go

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.

func CtxWithUser Uses

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

CtxWithUser attaches an Identity to a context.

func Middleware Uses

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

func UserFromCtx Uses

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.

Package auth imports 5 packages (graph) and is imported by 3 packages. Updated 2020-07-07. Refresh now. Tools for package owners.