summaryrefslogtreecommitdiff
path: root/csrf
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--csrf/csrf.go (renamed from csrf.go)8
1 files changed, 4 insertions, 4 deletions
diff --git a/csrf.go b/csrf/csrf.go
index 4539825..18fdb81 100644
--- a/csrf.go
+++ b/csrf/csrf.go
@@ -1,4 +1,4 @@
-package main
+package csrf
import (
"html/template"
@@ -8,12 +8,12 @@ import (
"github.com/gorilla/securecookie"
)
-func csrfHandler(next http.Handler) http.Handler {
+func Handler() func(http.Handler) http.Handler {
return csrf.Protect(
securecookie.GenerateRandomKey(32),
csrf.SameSite(csrf.SameSiteStrictMode),
csrf.FieldName("csrf.csrffield"), // should match the structure in `Csrf`
- )(next)
+ )
}
// Csrf handles the CSRF data for a form.
@@ -26,6 +26,6 @@ func (c *Csrf) SetCsrfField(r *http.Request) {
c.CsrfField = csrf.TemplateField(r)
}
-type WithCsrf interface {
+type Enabled interface {
SetCsrfField(r *http.Request)
}