diff options
Diffstat (limited to '')
-rw-r--r-- | csrf/csrf.go (renamed from csrf.go) | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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) } |