mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 05:01:50 +08:00
remove maxage from session token
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
"github.com/grafana/grafana/pkg/components/apikeygen"
|
"github.com/grafana/grafana/pkg/components/apikeygen"
|
||||||
@ -71,15 +70,14 @@ func GetContextHandler(ats *auth.UserAuthTokenService) macaron.Handler {
|
|||||||
|
|
||||||
if rotated {
|
if rotated {
|
||||||
ctx.Logger.Info("new token", "unhashed token", ctx.UserToken.UnhashedToken)
|
ctx.Logger.Info("new token", "unhashed token", ctx.UserToken.UnhashedToken)
|
||||||
//c.SetCookie("grafana_session", url.QueryEscape(ctx.UserToken.UnhashedToken), nil, setting.AppSubUrl+"/", setting.Domain, false, true)
|
ctx.Resp.Header().Del("Set-Cookie")
|
||||||
// ctx.Resp.Header().Del("Set-Cookie")
|
|
||||||
cookie := http.Cookie{
|
cookie := http.Cookie{
|
||||||
Name: "grafana_session",
|
Name: "grafana_session",
|
||||||
Value: url.QueryEscape(ctx.UserToken.UnhashedToken),
|
Value: url.QueryEscape(ctx.UserToken.UnhashedToken),
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
MaxAge: int(time.Minute * 10),
|
//MaxAge: 600,
|
||||||
Domain: setting.Domain,
|
Domain: setting.Domain,
|
||||||
Path: setting.AppSubUrl + "/",
|
Path: setting.AppSubUrl + "/",
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Resp.Header().Add("Set-Cookie", cookie.String())
|
ctx.Resp.Header().Add("Set-Cookie", cookie.String())
|
||||||
|
@ -46,9 +46,9 @@ func (s *UserAuthTokenService) UserAuthenticatedHook(user *models.User, c *model
|
|||||||
Name: sessionCookieKey,
|
Name: sessionCookieKey,
|
||||||
Value: url.QueryEscape(userToken.UnhashedToken),
|
Value: url.QueryEscape(userToken.UnhashedToken),
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
MaxAge: int(time.Minute * 10),
|
//MaxAge: 600,
|
||||||
Domain: setting.Domain,
|
Domain: setting.Domain,
|
||||||
Path: setting.AppSubUrl + "/",
|
Path: setting.AppSubUrl + "/",
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Resp.Header().Add("Set-Cookie", cookie.String())
|
c.Resp.Header().Add("Set-Cookie", cookie.String())
|
||||||
|
Reference in New Issue
Block a user