diff --git a/pkg/auth/oauth2/auth.go b/pkg/auth/oauth2/auth.go index df103725b8d..679d2da315e 100644 --- a/pkg/auth/oauth2/auth.go +++ b/pkg/auth/oauth2/auth.go @@ -433,3 +433,5 @@ func (c *Config) Complete() (*completedConfig, error) { func (a *OAuth2Authenticator) GetOCLoginCommand() string { return a.ocLoginCommand } + +func (a *OAuth2Authenticator) IsStatic() bool { return false } diff --git a/pkg/auth/static/auth.go b/pkg/auth/static/auth.go index c6fcd394558..1a1da0516e4 100644 --- a/pkg/auth/static/auth.go +++ b/pkg/auth/static/auth.go @@ -36,3 +36,4 @@ func (s *StaticAuthenticator) CallbackFunc(fn func(loginInfo sessions.LoginJSON, func (s *StaticAuthenticator) GetOCLoginCommand() string { return "" } func (s *StaticAuthenticator) LogoutRedirectURL() string { return "" } func (s *StaticAuthenticator) GetSpecialURLs() auth.SpecialAuthURLs { return auth.SpecialAuthURLs{} } +func (s *StaticAuthenticator) IsStatic() bool { return true } diff --git a/pkg/auth/types.go b/pkg/auth/types.go index 848fa1b9a5e..422af105e01 100644 --- a/pkg/auth/types.go +++ b/pkg/auth/types.go @@ -16,6 +16,7 @@ type Authenticator interface { GetOCLoginCommand() string LogoutRedirectURL() string GetSpecialURLs() SpecialAuthURLs + IsStatic() bool } type SpecialAuthURLs struct { diff --git a/pkg/server/server.go b/pkg/server/server.go index 3b72b185f74..037ce78eb32 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -137,6 +137,7 @@ type Server struct { AlertManagerTenancyProxyConfig *proxy.Config AlertManagerUserWorkloadHost string AlertManagerUserWorkloadProxyConfig *proxy.Config + AuthDisabled bool Authenticator auth.Authenticator BaseURL *url.URL Branding string @@ -664,6 +665,7 @@ func (s *Server) indexHandler(w http.ResponseWriter, r *http.Request) { } jsg := &jsGlobals{ + AuthDisabled: s.Authenticator.IsStatic(), ConsoleVersion: version.Version, BasePath: s.BaseURL.Path, LoginURL: proxy.SingleJoiningSlash(s.BaseURL.String(), authLoginEndpoint),