summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-macaron/csrf/csrf.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-macaron/csrf/csrf.go')
-rw-r--r--vendor/github.com/go-macaron/csrf/csrf.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/vendor/github.com/go-macaron/csrf/csrf.go b/vendor/github.com/go-macaron/csrf/csrf.go
index 19c9b479fa..00f3c3c9c0 100644
--- a/vendor/github.com/go-macaron/csrf/csrf.go
+++ b/vendor/github.com/go-macaron/csrf/csrf.go
@@ -25,7 +25,7 @@ import (
"gopkg.in/macaron.v1"
)
-const _VERSION = "0.1.0"
+const _VERSION = "0.1.1"
func Version() string {
return _VERSION
@@ -58,6 +58,8 @@ type csrf struct {
Form string
// Cookie name value for setting and getting csrf token.
Cookie string
+ //Cookie domain
+ CookieDomain string
//Cookie path
CookiePath string
// Cookie HttpOnly flag value used for the csrf token.
@@ -123,8 +125,10 @@ type Options struct {
Form string
// Cookie value used to set and get token.
Cookie string
+ // Cookie domain.
+ CookieDomain string
// Cookie path.
- CookiePath string
+ CookiePath string
CookieHttpOnly bool
// Key used for getting the unique ID per user.
SessionKey string
@@ -187,6 +191,7 @@ func Generate(options ...Options) macaron.Handler {
Header: opt.Header,
Form: opt.Form,
Cookie: opt.Cookie,
+ CookieDomain: opt.CookieDomain,
CookiePath: opt.CookiePath,
CookieHttpOnly: opt.CookieHttpOnly,
ErrorFunc: opt.ErrorFunc,
@@ -222,7 +227,7 @@ func Generate(options ...Options) macaron.Handler {
// FIXME: actionId.
x.Token = GenerateToken(x.Secret, x.ID, "POST")
if opt.SetCookie {
- ctx.SetCookie(opt.Cookie, x.Token, 0, opt.CookiePath, "", opt.Secure, opt.CookieHttpOnly, time.Now().AddDate(0, 0, 1))
+ ctx.SetCookie(opt.Cookie, x.Token, 0, opt.CookiePath, opt.CookieDomain, opt.Secure, opt.CookieHttpOnly, time.Now().AddDate(0, 0, 1))
}
}