csrf

package
v0.0.0-...-bfb77d9 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnonymousReceipt = "an"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CSRF

type CSRF struct {
	// contains filtered or unexported fields
}

func New

func New(store *sessions.CookieStore) *CSRF

New creates and returns a new CSRF manager

func (*CSRF) ClearToken

func (c *CSRF) ClearToken(w http.ResponseWriter, r *http.Request)

ClearToken clears the token from the user session. This should only be called after a successful POST or when a page is requested

func (*CSRF) CreateToken

func (c *CSRF) CreateToken(w http.ResponseWriter, r *http.Request)

CreateToken creates and stores a new CSRF token. It also writes the token to the client's session.

func (*CSRF) Validate

func (c *CSRF) Validate(w http.ResponseWriter, r *http.Request) bool

Validate ensures that a the token a client has is a valid one.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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