[MM-57085] Remove UseNewSAMLLibrary experimental setting (#26392)

Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Ben Schumacher 2024-04-05 16:56:01 +02:00 committed by GitHub
parent dc3e5b9269
commit c5cf4101da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 26 additions and 52 deletions

View File

@ -59,9 +59,6 @@ context('Okta', () => {
UsernameAttribute: 'Username',
LoginButtonText: loginButtonText,
},
ExperimentalSettings: {
UseNewSAMLLibrary: true,
},
GuestAccountsSettings: {
Enable: true,
},

View File

@ -55,9 +55,6 @@ context('LDAP SAML - Automated Tests (SAML TESTS)', () => {
UsernameAttribute: 'Username',
LoginButtonText: loginButtonText,
},
ExperimentalSettings: {
UseNewSAMLLibrary: false,
},
GuestAccountsSettings: {
Enable: true,
},

View File

@ -484,7 +484,6 @@
"ClientSideCertCheck": "secondary",
"LinkMetadataTimeoutMilliseconds": 5000,
"RestrictSystemAdmin": false,
"UseNewSAMLLibrary": false,
"EnableSharedChannels": false,
"EnableRemoteClusterService": false,
"DisableAppBar": false,

View File

@ -573,7 +573,6 @@ const defaultServerConfig: AdminConfig = {
ClientSideCertCheck: 'secondary',
LinkMetadataTimeoutMilliseconds: 5000,
RestrictSystemAdmin: false,
UseNewSAMLLibrary: false,
EnableSharedChannels: false,
EnableRemoteClusterService: false,
DisableAppBar: false,

View File

@ -110,8 +110,8 @@ func NewChannels(s *Server) (*Channels, error) {
if notificationInterface != nil {
ch.Notification = notificationInterface(New(ServerConnector(ch)))
}
if samlInterfaceNew != nil {
ch.Saml = samlInterfaceNew(New(ServerConnector(ch)))
if samlInterface != nil {
ch.Saml = samlInterface(New(ServerConnector(ch)))
if err := ch.Saml.ConfigureSP(request.EmptyContext(s.Log())); err != nil {
s.Log().Error("An error occurred while configuring SAML Service Provider", mlog.Err(err))
}

View File

@ -74,10 +74,10 @@ func RegisterCloudInterface(f func(*Server) einterfaces.CloudInterface) {
cloudInterface = f
}
var samlInterfaceNew func(*App) einterfaces.SamlInterface
var samlInterface func(*App) einterfaces.SamlInterface
func RegisterNewSamlInterface(f func(*App) einterfaces.SamlInterface) {
samlInterfaceNew = f
func RegisterSamlInterface(f func(*App) einterfaces.SamlInterface) {
samlInterface = f
}
var notificationInterface func(*App) einterfaces.NotificationInterface

View File

@ -19,34 +19,29 @@ import (
func TestSAMLSettings(t *testing.T) {
tt := []struct {
name string
setNewInterface bool
useNewSAMLLibrary bool
setInterface bool
isNil bool
metadata string
}{
{
name: "No SAML Interfaces, default setting",
setNewInterface: false,
useNewSAMLLibrary: false,
setInterface: false,
isNil: true,
},
{
name: "No SAML Interfaces, set config true",
setNewInterface: false,
useNewSAMLLibrary: true,
setInterface: false,
isNil: true,
},
{
name: "Both SAML Interfaces, default setting",
setNewInterface: true,
useNewSAMLLibrary: false,
setInterface: true,
isNil: false,
metadata: "samlTwo",
},
{
name: "Both SAML Interfaces, config true",
setNewInterface: true,
useNewSAMLLibrary: true,
setInterface: true,
isNil: false,
metadata: "samlTwo",
},
@ -57,12 +52,12 @@ func TestSAMLSettings(t *testing.T) {
saml2 := &mocks.SamlInterface{}
saml2.Mock.On("ConfigureSP", mock.AnythingOfType("*request.Context")).Return(nil)
saml2.Mock.On("GetMetadata", mock.AnythingOfType("*request.Context")).Return("samlTwo", nil)
if tc.setNewInterface {
RegisterNewSamlInterface(func(_ *App) einterfaces.SamlInterface {
if tc.setInterface {
RegisterSamlInterface(func(_ *App) einterfaces.SamlInterface {
return saml2
})
} else {
RegisterNewSamlInterface(nil)
RegisterSamlInterface(nil)
}
th := SetupEnterpriseWithStoreMock(t)
@ -84,12 +79,6 @@ func TestSAMLSettings(t *testing.T) {
mockStore.On("Post").Return(&mockPostStore)
mockStore.On("System").Return(&mockSystemStore)
if tc.useNewSAMLLibrary {
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ExperimentalSettings.UseNewSAMLLibrary = tc.useNewSAMLLibrary
})
}
if tc.isNil {
assert.Nil(t, th.App.Channels().Saml)
} else {

View File

@ -775,7 +775,6 @@ func (ts *TelemetryService) trackConfig() {
"isdefault_client_side_cert_check": isDefault(*cfg.ExperimentalSettings.ClientSideCertCheck, model.ClientSideCertCheckPrimaryAuth),
"link_metadata_timeout_milliseconds": *cfg.ExperimentalSettings.LinkMetadataTimeoutMilliseconds,
"restrict_system_admin": *cfg.ExperimentalSettings.RestrictSystemAdmin,
"use_new_saml_library": *cfg.ExperimentalSettings.UseNewSAMLLibrary,
"enable_shared_channels": *cfg.ExperimentalSettings.EnableSharedChannels,
"enable_remote_cluster_service": *cfg.ExperimentalSettings.EnableRemoteClusterService && cfg.FeatureFlags.EnableRemoteClusterService,
"enable_app_bar": !*cfg.ExperimentalSettings.DisableAppBar,

View File

@ -1009,7 +1009,6 @@ type ExperimentalSettings struct {
ClientSideCertCheck *string `access:"experimental_features,cloud_restrictable"`
LinkMetadataTimeoutMilliseconds *int64 `access:"experimental_features,write_restrictable,cloud_restrictable"`
RestrictSystemAdmin *bool `access:"experimental_features,write_restrictable"`
UseNewSAMLLibrary *bool `access:"experimental_features,cloud_restrictable"`
EnableSharedChannels *bool `access:"experimental_features"`
EnableRemoteClusterService *bool `access:"experimental_features"`
DisableAppBar *bool `access:"experimental_features"`
@ -1034,10 +1033,6 @@ func (s *ExperimentalSettings) SetDefaults() {
s.RestrictSystemAdmin = NewBool(false)
}
if s.UseNewSAMLLibrary == nil {
s.UseNewSAMLLibrary = NewBool(false)
}
if s.EnableSharedChannels == nil {
s.EnableSharedChannels = NewBool(false)
}

View File

@ -776,7 +776,6 @@ export type ExperimentalSettings = {
ClientSideCertCheck: string;
LinkMetadataTimeoutMilliseconds: number;
RestrictSystemAdmin: boolean;
UseNewSAMLLibrary: boolean;
EnableSharedChannels: boolean;
EnableRemoteClusterService: boolean;
DisableAppBar: boolean;