From d5e61e8093b9f74f6d71248dfb8599a5c15313f6 Mon Sep 17 00:00:00 2001 From: Maria A Nunez Date: Fri, 13 Aug 2021 09:57:26 -0400 Subject: [PATCH] MM-36084 - Certificate Auth: Remove SAML dependency in license check (#18113) --- api4/user.go | 2 +- api4/user_test.go | 4 ++-- config/client.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api4/user.go b/api4/user.go index 7a9c514e0c..188b067603 100644 --- a/api4/user.go +++ b/api4/user.go @@ -1791,7 +1791,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) { ldapOnly := props["ldap_only"] == "true" if *c.App.Config().ExperimentalSettings.ClientSideCertEnable { - if license := c.App.Srv().License(); license == nil || !*license.Features.SAML { + if license := c.App.Srv().License(); license == nil || !*license.Features.FutureFeatures { c.Err = model.NewAppError("ClientSideCertNotAllowed", "api.user.login.client_side_cert.license.app_error", nil, "", http.StatusBadRequest) return } diff --git a/api4/user_test.go b/api4/user_test.go index 7ecbd88881..a85548dbbc 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -3601,7 +3601,7 @@ func TestCBALogin(t *testing.T) { t.Run("primary", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() - th.App.Srv().SetLicense(model.NewTestLicense("saml")) + th.App.Srv().SetLicense(model.NewTestLicense("future_features")) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableBotAccountCreation = true @@ -3662,7 +3662,7 @@ func TestCBALogin(t *testing.T) { t.Run("secondary", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() - th.App.Srv().SetLicense(model.NewTestLicense("saml")) + th.App.Srv().SetLicense(model.NewTestLicense("future_features")) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableBotAccountCreation = true diff --git a/config/client.go b/config/client.go index d0690ff43f..5aa9174448 100644 --- a/config/client.go +++ b/config/client.go @@ -167,8 +167,9 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li props["SamlLastNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.LastNameAttribute != "") props["SamlNicknameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.NicknameAttribute != "") props["SamlPositionAttributeSet"] = strconv.FormatBool(*c.SamlSettings.PositionAttribute != "") + } - // do this under the correct licensed feature + if *license.Features.FutureFeatures { props["ExperimentalClientSideCertEnable"] = strconv.FormatBool(*c.ExperimentalSettings.ClientSideCertEnable) props["ExperimentalClientSideCertCheck"] = *c.ExperimentalSettings.ClientSideCertCheck }