Documentation
¶
Overview ¶
Package csrf provides a functionality for creating, destroying, validating, and attaching Cross-site Forgery Request protection tokens.
The tokens are attached as cookies to the request and are good for a single request. The caller can set a timeout duration as well that enables tokens to expire without being used.
Index ¶
Constants ¶
View Source
const (
// CookieName is the key value for the header attached to HTTP responses
CookieName = "X-CSRF"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
Handler handles Cross-site request forgery tokens
func NewHandler ¶
NewHandler creates a new handler using the database pointer.
func (*Handler) GenerateNewToken ¶
GenerateNewToken generates a new token for protecting against CSRF. The token is attached to the response writer as a cookie.
Click to show internal directories.
Click to hide internal directories.