You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
continuous-integration/drone/push Build is passing
Details
|
4 years ago | |
---|---|---|
.drone.yml | 4 years ago | |
LICENSE | 8 years ago | |
README.md | 4 years ago | |
circle.yml | 6 years ago | |
go.mod | 4 years ago | |
go.sum | 4 years ago | |
xsrf.go | 4 years ago | |
xsrf_test.go | 4 years ago |
README.md
xsrf

Middleware xsrf is a xsrf checker for Tango.
Installation
go get gitea.com/tango/xsrf
Simple Example
type XsrfAction struct {
render.Render
xsrf.Checker
}
func (x *XsrfAction) Get() error {
return x.Render("test.html", render.T{
"XsrfFormHtml": x.XsrfFormHtml(),
})
}
func (x *XsrfAction) Post() {
// xsrf will be checked before this being called
}
func main() {
t := tango.Classic()
t.Use(xsrf.New(expireTime))
t.Run()
}
If you don't want some action do not check, then
type NoCheckAction struct {
xsrf.NoCheck
}
func (x *NoCheckAction) Post() {
// xsrf will NOT be checked before this being called
}
will be ok.
License
This project is under BSD License. See the LICENSE file for the full license text.