MM-19867: - Implement allowing multiple SAML Libraries (#13299)

* Implement allowing multiple SAML Libraries

* fix unit tests

* updates based on review feedback

* Only set on startup, not config changes

* update unit tests, reload enterprise

* need to reset for previous tests

* update license statement

* fix licensing line
Этот коммит содержится в:
Scott Bishel
2019-12-18 15:35:53 -07:00
коммит произвёл GitHub
родитель 75ffd0b69e
Коммит be3e008dca
3 изменённых файлов: 133 добавлений и 1 удалений

Просмотреть файл

@@ -107,6 +107,12 @@ func RegisterSamlInterface(f func(*App) einterfaces.SamlInterface) {
samlInterface = f
}
var samlInterfaceNew func(*App) einterfaces.SamlInterface
func RegisterNewSamlInterface(f func(*App) einterfaces.SamlInterface) {
samlInterfaceNew = f
}
var notificationInterface func(*App) einterfaces.NotificationInterface
func RegisterNotificationInterface(f func(*App) einterfaces.NotificationInterface) {
@@ -136,7 +142,13 @@ func (s *Server) initEnterprise() {
s.Notification = notificationInterface(s.FakeApp())
}
if samlInterface != nil {
s.Saml = samlInterface(s.FakeApp())
if *s.FakeApp().Config().ExperimentalSettings.UseNewSAMLLibrary && samlInterfaceNew != nil {
mlog.Debug("Loading new SAML2 library")
s.Saml = samlInterfaceNew(s.FakeApp())
} else {
mlog.Debug("Loading original SAML library")
s.Saml = samlInterface(s.FakeApp())
}
s.AddConfigListener(func(_, cfg *model.Config) {
if err := s.Saml.ConfigureSP(); err != nil {
mlog.Error("An error occurred while configuring SAML Service Provider", mlog.Err(err))