authentication

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationCookieName     = "auth-token"
	SolutionNamespaceCookieName = "solution-namespace"
)

Variables

View Source
var (
	AppContextKey = &contextKey{"appContext"}
)

Functions

func ClearAuthCookie

func ClearAuthCookie(w http.ResponseWriter)

func SetAuthCookie

func SetAuthCookie(w http.ResponseWriter, token string)

func WebsocketInitFunc

func WebsocketInitFunc() transport.WebsocketInitFunc

WebsocketInitFunc is called by the gqlgen websocket transport to handle the first request. We use this to extract the auth-token to validate the request and set the session From https://github.com/99designs/gqlgen/blob/master/docs/content/recipes/authentication.md

Types

type AppContext

type AppContext struct {
	Token             uint
	SolutionNamespace string
	User              *domain.User
	Cancel            context.CancelFunc
}

func ForAppContext

func ForAppContext(ctx context.Context) *AppContext

type AuthMiddleWare

type AuthMiddleWare struct {
}

func NewAuthMiddleWare

func NewAuthMiddleWare() *AuthMiddleWare

func (*AuthMiddleWare) Authenticate

func (m *AuthMiddleWare) Authenticate(next http.Handler) http.Handler

From https://gqlgen.com/recipes/authentication/ If a user is not authenticated a temporary guest account will be created for this session.

Jump to

Keyboard shortcuts

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