security

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFMiddleware

func CSRFMiddleware(config CSRFConfig) core.Middleware

CSRFMiddleware returns a middleware that handles CSRF

Types

type CSRFConfig

type CSRFConfig struct {
	// TokenLength is the length of the CSRF token
	TokenLength uint8
	// CookieName is the name of the CSRF cookie
	CookieName string
	// CookiePath is the path of the CSRF cookie
	CookiePath string
	// CookieExpires is the expiration time of the CSRF cookie
	CookieExpires time.Duration
	// CookieSecure is the secure flag of the CSRF cookie
	CookieSecure bool
	// CookieHTTPOnly is the HTTPOnly flag of the CSRF cookie
	CookieHTTPOnly bool
	// HeaderName is the name of the CSRF header
	HeaderName string
}

CSRFConfig holds the configuration for the CSRF middleware

func DefaultCSRFConfig

func DefaultCSRFConfig() CSRFConfig

DefaultCSRFConfig returns a default CSRF configuration

Jump to

Keyboard shortcuts

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