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.
Click to show internal directories.
Click to hide internal directories.