csrf

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package csrf provides CSRF protection middleware for rex routers.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingToken = errors.New("missing CSRF token")
	ErrInvalidToken = errors.New("invalid CSRF token")
)

Functions

func CreateToken

func CreateToken() (string, error)

CreateToken generates a random CSRF token.

func New

func New(store sessions.Store, secureCookie bool) rex.Middleware

New returns middleware that sets and verifies CSRF tokens using cookies and forms. Set the token in forms using {{ .csrf_token }} in templates. If secureCookie is true, the token cookie is transmitted only over HTTPS.

Types

This section is empty.

Jump to

Keyboard shortcuts

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