Documentation
¶
Index ¶
- func RedirectForClient(w http.ResponseWriter, r *http.Request, targetURL string)
- func RedirectIfAuthenticated(parseToken func(token string) (*paseto.Claims, error), dashboardURL string) func(http.Handler) http.Handler
- func SessionAuth(parseToken func(token string) (*paseto.Claims, error), loginURL string) func(http.Handler) http.Handler
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.
Click to show internal directories.
Click to hide internal directories.