Documentation
¶
Index ¶
- func ClearSessionCookie(w http.ResponseWriter)
- func RequireAuth(db *sql.DB, loginURL string) func(http.Handler) http.Handler
- func SessionCookieName() string
- func SetSessionCookie(w http.ResponseWriter, token string, maxAge int)
- func TenantFromContext(ctx context.Context) *tenant.Tenant
- func WithTenantContext(ctx context.Context, tn *tenant.Tenant) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearSessionCookie ¶
func ClearSessionCookie(w http.ResponseWriter)
ClearSessionCookie removes the session cookie.
func RequireAuth ¶
RequireAuth validates the session cookie and injects the tenant into context. Redirects to loginURL if no valid session is found.
func SessionCookieName ¶
func SessionCookieName() string
SessionCookieName returns the session cookie name based on the BASE_URL scheme.
func SetSessionCookie ¶
func SetSessionCookie(w http.ResponseWriter, token string, maxAge int)
SetSessionCookie sets the session cookie with security attributes.
func TenantFromContext ¶
TenantFromContext extracts the tenant from the request context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.