Help us shape the future of Go! Take the 2026 Go Developer Survey

csrf

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingHeader = errors.New("CSRF missing csrf token in header")
	ErrInvalidToken  = errors.New("CSRF invalid token")
)

Functions

This section is empty.

Types

type Csrf

type Csrf struct {
	Key           string
	CookieName    string
	SaltName      string
	HeaderName    string
	Domain        string
	IgnoreMethods map[string]bool
}

func New

func New(options ...Option) *Csrf

func (*Csrf) SetToken

func (x *Csrf) SetToken(c *app.RequestContext)

func (*Csrf) Tokenize

func (x *Csrf) Tokenize(salt string) string

func (*Csrf) VerifyToken

func (x *Csrf) VerifyToken(skip bool) app.HandlerFunc

type Option

type Option func(x *Csrf)

func SetCookieName

func SetCookieName(v string) Option

func SetDomain added in v0.5.4

func SetDomain(v string) Option

func SetHeaderName

func SetHeaderName(v string) Option

func SetIgnoreMethods

func SetIgnoreMethods(methods []string) Option

func SetKey

func SetKey(v string) Option

func SetSaltName

func SetSaltName(v string) Option

Jump to

Keyboard shortcuts

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