Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCSRFToken ¶
Types ¶
type Middleware ¶
type Middleware struct { // Name of the cookie with the first csrf token. CookieName string // `Secure` cookie attribute. Secure bool // `SameSite` cookie attribute. SameSite http.SameSite // Name of the form field with the second token. FormFieldName string // Name of the header with the second token. HeaderName string // Length of generated CSRF tokens in bytes (symbols). TokenLength uint }
func New ¶
func New() Middleware
Create a new instance of CSRF middleware. You can tweak settings after initialization.
func (*Middleware) Middleware ¶
func (m *Middleware) Middleware(next http.Handler) http.Handler
Middleware to prevent CSRF attacks.
Click to show internal directories.
Click to hide internal directories.