From 0d999d1bba77e6e9012e3ecf41728c2e5a04cfad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Thu, 9 Nov 2023 15:58:29 +0100 Subject: [PATCH] Change external auth providers to always reload on settings change --- server/auth/auth.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/auth/auth.go b/server/auth/auth.go index 6c2ad549d..6fe8b1bdd 100644 --- a/server/auth/auth.go +++ b/server/auth/auth.go @@ -340,10 +340,13 @@ func (svc *service) UpdateSettings(s *settings.Settings) { } } - if len(svc.settings.Providers) != len(s.Providers) { - svc.log.Debug("setting changed", zap.Int("providers", len(s.Providers))) - external.SetupGothProviders(svc.log, svc.opt.ExternalRedirectURL, s.Providers...) - } + // Always reload external providers. + // This could be optionally skipped by strictly comparing if they actually changed. + // OIDC complicates it a bit wit all the mix and matching. + // Should be ok for now. + // @todo see if we can conditionally skip this + svc.log.Debug("setting changed", zap.Int("providers", len(s.Providers))) + external.SetupGothProviders(svc.log, svc.opt.ExternalRedirectURL, s.Providers...) svc.settings = s svc.handlers.Settings = s