Commit 2bc70f62 authored by asta.xie's avatar asta.xie

delete MaxAge cookielifeTime replace

parent 8bf0e67b
...@@ -56,11 +56,10 @@ type managerConfig struct { ...@@ -56,11 +56,10 @@ type managerConfig struct {
EnableSetCookie bool `json:"enableSetCookie,omitempty"` EnableSetCookie bool `json:"enableSetCookie,omitempty"`
Gclifetime int64 `json:"gclifetime"` Gclifetime int64 `json:"gclifetime"`
Maxlifetime int64 `json:"maxLifetime"` Maxlifetime int64 `json:"maxLifetime"`
Maxage int `json:"maxage"`
Secure bool `json:"secure"` Secure bool `json:"secure"`
SessionIDHashFunc string `json:"sessionIDHashFunc"` SessionIDHashFunc string `json:"sessionIDHashFunc"`
SessionIDHashKey string `json:"sessionIDHashKey"` SessionIDHashKey string `json:"sessionIDHashKey"`
CookieLifeTime int64 `json:"cookieLifeTime"` CookieLifeTime int `json:"cookieLifeTime"`
ProviderConfig string `json:"providerConfig"` ProviderConfig string `json:"providerConfig"`
} }
...@@ -125,8 +124,8 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se ...@@ -125,8 +124,8 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
Path: "/", Path: "/",
HttpOnly: true, HttpOnly: true,
Secure: manager.config.Secure} Secure: manager.config.Secure}
if manager.config.Maxage >= 0 { if manager.config.CookieLifeTime >= 0 {
cookie.MaxAge = manager.config.Maxage cookie.MaxAge = manager.config.CookieLifeTime
} }
if manager.config.EnableSetCookie { if manager.config.EnableSetCookie {
http.SetCookie(w, cookie) http.SetCookie(w, cookie)
...@@ -144,8 +143,8 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se ...@@ -144,8 +143,8 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
Path: "/", Path: "/",
HttpOnly: true, HttpOnly: true,
Secure: manager.config.Secure} Secure: manager.config.Secure}
if manager.config.Maxage >= 0 { if manager.config.CookieLifeTime >= 0 {
cookie.MaxAge = manager.config.Maxage cookie.MaxAge = manager.config.CookieLifeTime
} }
if manager.config.EnableSetCookie { if manager.config.EnableSetCookie {
http.SetCookie(w, cookie) http.SetCookie(w, cookie)
...@@ -206,8 +205,8 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque ...@@ -206,8 +205,8 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque
cookie.HttpOnly = true cookie.HttpOnly = true
cookie.Path = "/" cookie.Path = "/"
} }
if manager.config.Maxage >= 0 { if manager.config.CookieLifeTime >= 0 {
cookie.MaxAge = manager.config.Maxage cookie.MaxAge = manager.config.CookieLifeTime
} }
http.SetCookie(w, cookie) http.SetCookie(w, cookie)
r.AddCookie(cookie) r.AddCookie(cookie)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment