mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #12077 from roidelapluie/logout
Fix #9847 Add a generic signout_redirect_url to enable oauth logout
This commit is contained in:
@@ -237,6 +237,9 @@ disable_login_form = false
|
|||||||
# Set to true to disable the signout link in the side menu. useful if you use auth.proxy
|
# Set to true to disable the signout link in the side menu. useful if you use auth.proxy
|
||||||
disable_signout_menu = false
|
disable_signout_menu = false
|
||||||
|
|
||||||
|
# URL to redirect the user to after sign out
|
||||||
|
signout_redirect_url =
|
||||||
|
|
||||||
#################################### Anonymous Auth ######################
|
#################################### Anonymous Auth ######################
|
||||||
[auth.anonymous]
|
[auth.anonymous]
|
||||||
# enable anonymous access
|
# enable anonymous access
|
||||||
|
|||||||
@@ -217,6 +217,9 @@ log_queries =
|
|||||||
# Set to true to disable the signout link in the side menu. useful if you use auth.proxy, defaults to false
|
# Set to true to disable the signout link in the side menu. useful if you use auth.proxy, defaults to false
|
||||||
;disable_signout_menu = false
|
;disable_signout_menu = false
|
||||||
|
|
||||||
|
# URL to redirect the user to after sign out
|
||||||
|
;signout_redirect_url =
|
||||||
|
|
||||||
#################################### Anonymous Auth ##########################
|
#################################### Anonymous Auth ##########################
|
||||||
[auth.anonymous]
|
[auth.anonymous]
|
||||||
# enable anonymous access
|
# enable anonymous access
|
||||||
|
|||||||
@@ -155,5 +155,9 @@ func Logout(c *m.ReqContext) {
|
|||||||
c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl+"/")
|
c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl+"/")
|
||||||
c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl+"/")
|
c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl+"/")
|
||||||
c.Session.Destory(c.Context)
|
c.Session.Destory(c.Context)
|
||||||
c.Redirect(setting.AppSubUrl + "/login")
|
if setting.SignoutRedirectUrl != "" {
|
||||||
|
c.Redirect(setting.SignoutRedirectUrl)
|
||||||
|
} else {
|
||||||
|
c.Redirect(setting.AppSubUrl + "/login")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ var (
|
|||||||
DefaultTheme string
|
DefaultTheme string
|
||||||
DisableLoginForm bool
|
DisableLoginForm bool
|
||||||
DisableSignoutMenu bool
|
DisableSignoutMenu bool
|
||||||
|
SignoutRedirectUrl string
|
||||||
ExternalUserMngLinkUrl string
|
ExternalUserMngLinkUrl string
|
||||||
ExternalUserMngLinkName string
|
ExternalUserMngLinkName string
|
||||||
ExternalUserMngInfo string
|
ExternalUserMngInfo string
|
||||||
@@ -600,6 +601,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
|||||||
auth := iniFile.Section("auth")
|
auth := iniFile.Section("auth")
|
||||||
DisableLoginForm = auth.Key("disable_login_form").MustBool(false)
|
DisableLoginForm = auth.Key("disable_login_form").MustBool(false)
|
||||||
DisableSignoutMenu = auth.Key("disable_signout_menu").MustBool(false)
|
DisableSignoutMenu = auth.Key("disable_signout_menu").MustBool(false)
|
||||||
|
SignoutRedirectUrl = auth.Key("signout_redirect_url").String()
|
||||||
|
|
||||||
// anonymous access
|
// anonymous access
|
||||||
AnonymousEnabled = iniFile.Section("auth.anonymous").Key("enabled").MustBool(false)
|
AnonymousEnabled = iniFile.Section("auth.anonymous").Key("enabled").MustBool(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user