GenerateXSRF

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenRandNumber3x

func GenRandNumber3x() (buf string)

GenRandNumber3x Generates a random value that is 0x100000 or larger

Types

type GenerateXSRFHandlerType

type GenerateXSRFHandlerType struct {
	Next               http.Handler //
	Paths              []string     //
	Base               []string     // If avaiable the ${1} matching nth base will be used - else - the Host
	ValidPaths         []string     //
	UserCookieName     string       // if Name starts with "-" then delete existing header before creating new one.
	ValueCookieName    string       // if Name starts with "-" then delete existing header before creating new one.
	RedisPrefix        string       // Key prefix to save users under in redis, default XSRF:
	RedisSessionPrefix string       // Alternative prefix if using sessions, "Session:" for example
	MaxAge             int          //
	RedirectToLogin    bool         //
	LoginURL           []string     // Positional match to ValidPaths - if it matches that Nth valid path and RedirectToLogin is true and you have this then 307 redirect to that location.
	LineNo             int          //
	// contains filtered or unexported fields
}

GenerateXSRFHandlerType keeps all the configuration for this middleware

func (*GenerateXSRFHandlerType) InitializeWithConfigData

func (hdlr *GenerateXSRFHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*GenerateXSRFHandlerType) PreValidate

func (hdlr *GenerateXSRFHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*GenerateXSRFHandlerType) ServeHTTP

func (hdlr *GenerateXSRFHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)

ServeHTTP called in stack implements the token add and check.

Jump to

Keyboard shortcuts

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