diff options
author | Tamal Saha <tamal@appscode.com> | 2019-07-12 06:57:31 -0700 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-07-12 09:57:31 -0400 |
commit | 2102f9d92db308f694707ebe6253beb20c5f7505 (patch) | |
tree | 2a09910b2fb4b3b4c151966c3a7620f48a566633 /vendor | |
parent | d95237b56199934418816aaef4881ca538637c05 (diff) | |
download | gitea-2102f9d92db308f694707ebe6253beb20c5f7505.tar.gz gitea-2102f9d92db308f694707ebe6253beb20c5f7505.zip |
Support setting cookie domain (#6288)
Signed-off-by: Tamal Saha <tamal@appscode.com>
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/go-macaron/csrf/.travis.yml | 1 | ||||
-rw-r--r-- | vendor/github.com/go-macaron/csrf/csrf.go | 11 | ||||
-rw-r--r-- | vendor/github.com/go-macaron/csrf/xsrf.go | 4 | ||||
-rw-r--r-- | vendor/github.com/go-macaron/i18n/.travis.yml | 15 | ||||
-rw-r--r-- | vendor/github.com/go-macaron/i18n/i18n.go | 6 | ||||
-rw-r--r-- | vendor/modules.txt | 4 |
6 files changed, 22 insertions, 19 deletions
diff --git a/vendor/github.com/go-macaron/csrf/.travis.yml b/vendor/github.com/go-macaron/csrf/.travis.yml index 8d6a90868c..81680f0f02 100644 --- a/vendor/github.com/go-macaron/csrf/.travis.yml +++ b/vendor/github.com/go-macaron/csrf/.travis.yml @@ -1,7 +1,6 @@ sudo: false language: go go: - - 1.5.x - 1.6.x - 1.7.x - 1.8.x 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)) } } diff --git a/vendor/github.com/go-macaron/csrf/xsrf.go b/vendor/github.com/go-macaron/csrf/xsrf.go index 81ed5d0fc5..7f31894f95 100644 --- a/vendor/github.com/go-macaron/csrf/xsrf.go +++ b/vendor/github.com/go-macaron/csrf/xsrf.go @@ -50,7 +50,7 @@ func generateTokenAtTime(key, userID, actionID string, now time.Time) string { h := hmac.New(sha1.New, []byte(key)) fmt.Fprintf(h, "%s:%s:%d", clean(userID), clean(actionID), now.UnixNano()) tok := fmt.Sprintf("%s:%d", h.Sum(nil), now.UnixNano()) - return base64.URLEncoding.EncodeToString([]byte(tok)) + return base64.RawURLEncoding.EncodeToString([]byte(tok)) } // Valid returns true if token is a valid, unexpired token returned by Generate. @@ -61,7 +61,7 @@ func ValidToken(token, key, userID, actionID string) bool { // validTokenAtTime is like Valid, but it uses now to check if the token is expired. func validTokenAtTime(token, key, userID, actionID string, now time.Time) bool { // Decode the token. - data, err := base64.URLEncoding.DecodeString(token) + data, err := base64.RawURLEncoding.DecodeString(token) if err != nil { return false } diff --git a/vendor/github.com/go-macaron/i18n/.travis.yml b/vendor/github.com/go-macaron/i18n/.travis.yml index 2774fb35d5..f331c2c84a 100644 --- a/vendor/github.com/go-macaron/i18n/.travis.yml +++ b/vendor/github.com/go-macaron/i18n/.travis.yml @@ -1,14 +1,11 @@ sudo: false language: go - go: - - 1.3 - - 1.4 - - 1.5 - - tip + - 1.6.x + - 1.7.x + - 1.8.x + - 1.9.x + - 1.10.x + - 1.11.x script: go test -v -cover -race - -notifications: - email: - - u@gogs.io diff --git a/vendor/github.com/go-macaron/i18n/i18n.go b/vendor/github.com/go-macaron/i18n/i18n.go index 3b5b1b834d..4f386a0bbd 100644 --- a/vendor/github.com/go-macaron/i18n/i18n.go +++ b/vendor/github.com/go-macaron/i18n/i18n.go @@ -26,7 +26,7 @@ import ( "gopkg.in/macaron.v1" ) -const _VERSION = "0.3.0" +const _VERSION = "0.4.0" func Version() string { return _VERSION @@ -96,6 +96,8 @@ type Options struct { TmplName string // Configuration section name. Default is "i18n". Section string + // Domain used for `lang` cookie. Default is "" + CookieDomain string } func prepareOptions(options []Options) Options { @@ -193,7 +195,7 @@ func I18n(options ...Options) macaron.Handler { // Save language information in cookies. if !hasCookie { - ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/"+strings.TrimPrefix(opt.SubURL, "/")) + ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/"+strings.TrimPrefix(opt.SubURL, "/"), opt.CookieDomain) } restLangs := make([]LangType, 0, i18n.Count()-1) diff --git a/vendor/modules.txt b/vendor/modules.txt index 0e9d3c3163..567ace1877 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -128,9 +128,9 @@ github.com/go-macaron/cache/redis github.com/go-macaron/captcha # github.com/go-macaron/cors v0.0.0-20190309005821-6fd6a9bfe14e9 github.com/go-macaron/cors -# github.com/go-macaron/csrf v0.0.0-20180426211211-503617c6b372 +# github.com/go-macaron/csrf v0.0.0-20190131233648-3751b136073c github.com/go-macaron/csrf -# github.com/go-macaron/i18n v0.0.0-20160612092837-ef57533c3b0f +# github.com/go-macaron/i18n v0.0.0-20190131234336-56731837a73b github.com/go-macaron/i18n # github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191 github.com/go-macaron/inject |