AuthN: Support reloading SSO config after the sso settings have changed (#80734)

* Add AuthNSvc reload handling

* Working, need to add test

* Remove commented out code

* Add Reload implementation to connectors

* Align and add tests, refactor

* Add more tests, linting

* Add extra checks + tests to oauth client

* Clean up based on reviews

* Move config instantiation into newSocialBase

* Use specific error
This commit is contained in:
Misi
2024-01-22 14:54:48 +01:00
committed by GitHub
parent 1f4a520b9d
commit 20bb0a3ab1
31 changed files with 889 additions and 217 deletions
@@ -84,7 +84,7 @@ func (s *SSOSettingsStore) List(ctx context.Context) ([]*models.SSOSettings, err
return result, nil
}
func (s *SSOSettingsStore) Upsert(ctx context.Context, settings models.SSOSettings) error {
func (s *SSOSettingsStore) Upsert(ctx context.Context, settings *models.SSOSettings) error {
if settings.Provider == "" {
return ssosettings.ErrNotFound
}
@@ -110,13 +110,10 @@ func (s *SSOSettingsStore) Upsert(ctx context.Context, settings models.SSOSettin
}
_, err = sess.UseBool(isDeletedColumn).Update(updated, existing)
} else {
_, err = sess.Insert(&models.SSOSettings{
ID: uuid.New().String(),
Provider: settings.Provider,
Settings: settings.Settings,
Created: now,
Updated: now,
})
settings.ID = uuid.New().String()
settings.Created = now
settings.Updated = now
_, err = sess.Insert(settings)
}
return err