middleware

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedirectForClient

func RedirectForClient(w http.ResponseWriter, r *http.Request, targetURL string)

RedirectForClient handles redirects for both standard and HTMX requests.

func RedirectIfAuthenticated

func RedirectIfAuthenticated(parseToken func(token string) (*paseto.Claims, error), dashboardURL string) func(http.Handler) http.Handler

RedirectIfAuthenticated is a middleware that redirects the user if they already have a valid session. Useful for /login or /register pages.

func SessionAuth

func SessionAuth(parseToken func(token string) (*paseto.Claims, error), loginURL string) func(http.Handler) http.Handler

SessionAuth is the middleware that validates the PASETO JWT from a cookie and adds the user_id and tenant_id to the context. If the token is missing or invalid, it redirects to the login page.

Types

This section is empty.

Jump to

Keyboard shortcuts

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