Skip to content

Commit

Permalink
Merge pull request #1 from kalbhor/master
Browse files Browse the repository at this point in the history
feat: new flag for non https support
  • Loading branch information
joeirimpan authored Sep 16, 2021
2 parents 9276fac + eabbb6b commit 10d49b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ type Config struct {
Path string
// cookie domain
Domain string
// set this true for non https
Unsecure bool
}
4 changes: 2 additions & 2 deletions csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *CSRF) Inject(handler fastglue.FastRequestHandler) fastglue.FastRequestH
Value: value,
MaxAge: c.cfg.MaxAge,
Path: c.cfg.Path,
Secure: true,
Secure: !c.cfg.Unsecure,
HttpOnly: true,
SameSite: http.SameSite(c.cfg.SameSite),
Domain: c.cfg.Domain,
Expand Down Expand Up @@ -152,7 +152,7 @@ func (c *CSRF) deny(r *fastglue.Request) {
Value: "",
Expires: fasthttp.CookieExpireDelete,
Path: "/",
Secure: true,
Secure: !c.cfg.Unsecure,
HttpOnly: true,
}, r)

Expand Down

0 comments on commit 10d49b8

Please sign in to comment.