Documentation ¶
Overview ¶
Package ac provides facilities for generating and verifying anti-CSRF authentication codes.
Index ¶
- func GetAK(req *http.Request) []byte
- func IsSafeMethod(methodName string) bool
- func New(req *http.Request, action string) string
- func NewFor(action string, ak []byte) string
- func Protect(f func(rw http.ResponseWriter, req *http.Request)) http.Handler
- func Protectn(fieldName string, f func(rw http.ResponseWriter, req *http.Request)) http.Handler
- func Verify(req *http.Request, ac string) bool
- func VerifyFor(action, ac string, ak []byte) bool
- func VerifyStr(req *http.Request, action, ac string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSafeMethod ¶
func Protect ¶
http.Handler wrapper that bails if a valid action key for the request URL's path is not found in GET/POST variable "ac".
func Protectn ¶
http.Handler wrapper that bails if a valid action key for the request URL's path is not found in the GET/POST variable whose name is specified in fieldName.
func Verify ¶
Verify an action code in relation to a given request. The action is the path of the request URL. Returns true iff valid.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.