Documentation
¶
Overview ¶
Package canopygin mounts Canopy on a Gin router.
Mount registers the Canopy handler at the configured base path. The middleware helpers bridge Canopy's net/http middleware into Gin handler functions. Session data stays in the request context, so handlers read it with Session or canopy.SessionFromContext.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
Mount registers the Canopy handler on the router at the base path from Config.BasePath. Do not wrap the handler with http.StripPrefix.
func OptionalSession ¶
func OptionalSession(a *canopy.Auth) gin.HandlerFunc
OptionalSession returns middleware that adds session data to the request context when a valid session is present and continues anonymously otherwise.
func RequireSession ¶
func RequireSession(a *canopy.Auth) gin.HandlerFunc
RequireSession returns middleware that adds session data to the request context or ends the request with a 401 JSON error.
Types ¶
This section is empty.