Documentation
¶
Overview ¶
Package csrf provides session-bound synchronizer tokens.
The package deliberately does not inspect HTTP requests. Applications choose where a submitted token comes from and pass it to Validate explicitly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidToken indicates that a submitted token is absent, malformed, or // does not belong to the current session. ErrInvalidToken = errors.New("csrf: invalid token") // ErrSessionRequired indicates programmer error: CSRF tokens must be bound // to an initialized session. ErrSessionRequired = errors.New("csrf: session is required") )
Functions ¶
func Ensure ¶
Ensure returns the current session's token, creating one when absent. The caller must save the session before writing the response when a token is created.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.