Documentation
¶
Index ¶
- Constants
- func CORSMiddleware(next http.Handler) http.Handler
- func CSRFMiddleware(next http.Handler) http.Handler
- func CSRFMiddlewareWithExemptions(exemptSuffixes []string) func(http.Handler) http.Handler
- func GetCSRFToken(maxAgeSeconds int) *http.Cookie
- func WhitelistCORSMiddleware(allowedOrigins []string, next http.Handler) http.Handler
Constants ¶
View Source
const ( // CSRFTokenHeader is the name of the header used to send the CSRF token in requests. //nolint:gosec // really? CSRFTokenHeader = "X-Krb-Csrf-Token" SessionCookieName = "session" RefreshCookieName = "refresh" CSRFCookieName = "csrf" )
Variables ¶
This section is empty.
Functions ¶
func CORSMiddleware ¶
CORSMiddleware is a middleware that adds CORS headers to the response.
func CSRFMiddleware ¶
CSRFMiddleware is an HTTP middleware that checks for the presence of a valid CSRF token in requests. It should be used for all endpoints that modify state (e.g., POST, PUT, DELETE).
func GetCSRFToken ¶
GetCSRFToken generates a new CSRF token and returns it as an HTTP cookie.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.