mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
removes unused/commented code
This commit is contained in:
parent
ff483f3782
commit
f257101c41
@ -143,7 +143,6 @@ provider = file
|
|||||||
|
|
||||||
provider_config = sessions
|
provider_config = sessions
|
||||||
|
|
||||||
|
|
||||||
# Session cookie name
|
# Session cookie name
|
||||||
cookie_name = grafana_sess
|
cookie_name = grafana_sess
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
|
|||||||
query.UserId = getRequestUserId(ctx)
|
query.UserId = getRequestUserId(ctx)
|
||||||
// if we're using ldap, pass authproxy login name to ldap user sync
|
// if we're using ldap, pass authproxy login name to ldap user sync
|
||||||
} else if setting.LdapEnabled {
|
} else if setting.LdapEnabled {
|
||||||
ctx.Session.Delete(session.SESS_KEY_LASTLDAPSYNC) //makes sure we always sync with ldap if session if we only have last sync info in session but not user.
|
ctx.Session.Delete(session.SESS_KEY_LASTLDAPSYNC)
|
||||||
|
|
||||||
syncQuery := &m.LoginUserQuery{
|
syncQuery := &m.LoginUserQuery{
|
||||||
ReqContext: ctx,
|
ReqContext: ctx,
|
||||||
|
@ -88,29 +88,6 @@ func initContextWithAnonymousUser(ctx *m.ReqContext) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// func initContextWithUserSessionCookie(ctx *m.ReqContext, orgId int64) bool {
|
|
||||||
// // initialize session
|
|
||||||
// if err := ctx.Session.Start(ctx.Context); err != nil {
|
|
||||||
// ctx.Logger.Error("Failed to start session", "error", err)
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var userId int64
|
|
||||||
// if userId = getRequestUserId(ctx); userId == 0 {
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
|
|
||||||
// query := m.GetSignedInUserQuery{UserId: userId, OrgId: orgId}
|
|
||||||
// if err := bus.Dispatch(&query); err != nil {
|
|
||||||
// ctx.Logger.Error("Failed to get user with id", "userId", userId, "error", err)
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ctx.SignedInUser = query.Result
|
|
||||||
// ctx.IsSignedIn = true
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
|
|
||||||
func initContextWithApiKey(ctx *m.ReqContext) bool {
|
func initContextWithApiKey(ctx *m.ReqContext) bool {
|
||||||
var keyString string
|
var keyString string
|
||||||
if keyString = getApiKey(ctx); keyString == "" {
|
if keyString = getApiKey(ctx); keyString == "" {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/session"
|
"github.com/grafana/grafana/pkg/services/session"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
"gopkg.in/macaron.v1"
|
macaron "gopkg.in/macaron.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRecoveryMiddleware(t *testing.T) {
|
func TestRecoveryMiddleware(t *testing.T) {
|
||||||
@ -67,7 +67,6 @@ func recoveryScenario(desc string, url string, fn scenarioFunc) {
|
|||||||
sc.m.Use(GetContextHandler(sc.userAuthTokenService))
|
sc.m.Use(GetContextHandler(sc.userAuthTokenService))
|
||||||
// mock out gc goroutine
|
// mock out gc goroutine
|
||||||
session.StartSessionGC = func() {}
|
session.StartSessionGC = func() {}
|
||||||
//sc.m.Use(Sessioner(&ms.Options{}, 0))
|
|
||||||
sc.m.Use(OrgRedirect())
|
sc.m.Use(OrgRedirect())
|
||||||
sc.m.Use(AddDefaultResponseHeaders())
|
sc.m.Use(AddDefaultResponseHeaders())
|
||||||
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package middleware
|
|
||||||
|
|
||||||
// func Sessioner(options *ms.Options, sessionConnMaxLifetime int64) macaron.Handler {
|
|
||||||
// session.Init(options, sessionConnMaxLifetime)
|
|
||||||
|
|
||||||
// return func(ctx *m.ReqContext) {
|
|
||||||
// ctx.Next()
|
|
||||||
|
|
||||||
// if err := ctx.Session.Release(); err != nil {
|
|
||||||
// panic("session(release): " + err.Error())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -223,7 +223,6 @@ type Cfg struct {
|
|||||||
EnterpriseLicensePath string
|
EnterpriseLicensePath string
|
||||||
|
|
||||||
LoginCookieName string
|
LoginCookieName string
|
||||||
LoginCookieUsername string
|
|
||||||
LoginCookieSecure bool
|
LoginCookieSecure bool
|
||||||
LoginCookieMaxDays int
|
LoginCookieMaxDays int
|
||||||
LoginCookieRotation time.Duration
|
LoginCookieRotation time.Duration
|
||||||
@ -556,7 +555,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
|||||||
cfg.LoginCookieName = login.Key("cookie_name").MustString("grafana_session")
|
cfg.LoginCookieName = login.Key("cookie_name").MustString("grafana_session")
|
||||||
cfg.LoginCookieMaxDays = login.Key("login_remember_days").MustInt(7)
|
cfg.LoginCookieMaxDays = login.Key("login_remember_days").MustInt(7)
|
||||||
cfg.LoginCookieSecure = login.Key("cookie_secure").MustBool(false)
|
cfg.LoginCookieSecure = login.Key("cookie_secure").MustBool(false)
|
||||||
cfg.LoginCookieUsername = login.Key("cookie_username").MustString("grafana_username")
|
|
||||||
cfg.LoginDeleteExpiredTokensAfterDays = login.Key("delete_expired_token_after_days").MustInt(30)
|
cfg.LoginDeleteExpiredTokensAfterDays = login.Key("delete_expired_token_after_days").MustInt(30)
|
||||||
cfg.LoginCookieRotation = login.Key("rotate_cookie_every").MustDuration(time.Minute * 30)
|
cfg.LoginCookieRotation = login.Key("rotate_cookie_every").MustDuration(time.Minute * 30)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user