MM-27688-OpenId Connect (#16222)
* implement openid connect * update error strings * handle OpenIdSetting.Secret as FAKE SETTING * add openid to telemetry * update config defaults, add telemetry * fix bug with Office365 * Retrieve Office365 AuthData from IdToken * fix linter * add feature flag, reset defaults for config * fix build error * fix unit tests * add authentication permission to Feature Flags * turn off feature flag * set default button color * set default button color only on openid * fix for merging FeatureFlags in config * remove feature flag * revert config changes * remove debug statements Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2a71fc5ee2
Коммит
f548ecbee1
@@ -288,6 +288,9 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m
|
||||
props["SamlLoginButtonTextColor"] = ""
|
||||
props["EnableSignUpWithGoogle"] = "false"
|
||||
props["EnableSignUpWithOffice365"] = "false"
|
||||
props["EnableSignUpWithOpenId"] = "false"
|
||||
props["OpenIdButtonText"] = ""
|
||||
props["OpenIdButtonColor"] = ""
|
||||
props["CWSUrl"] = ""
|
||||
props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
|
||||
props["CustomBrandText"] = *c.TeamSettings.CustomBrandText
|
||||
@@ -322,6 +325,12 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m
|
||||
props["EnableSignUpWithOffice365"] = strconv.FormatBool(*c.Office365Settings.Enable)
|
||||
}
|
||||
|
||||
if *license.Features.OpenId {
|
||||
props["EnableSignUpWithOpenId"] = strconv.FormatBool(*c.OpenIdSettings.Enable)
|
||||
props["OpenIdButtonColor"] = *c.OpenIdSettings.ButtonColor
|
||||
props["OpenIdButtonText"] = *c.OpenIdSettings.ButtonText
|
||||
}
|
||||
|
||||
if *license.Features.CustomTermsOfService {
|
||||
props["EnableCustomTermsOfService"] = strconv.FormatBool(*c.SupportSettings.CustomTermsOfServiceEnabled)
|
||||
props["CustomTermsOfServiceReAcceptancePeriod"] = strconv.FormatInt(int64(*c.SupportSettings.CustomTermsOfServiceReAcceptancePeriod), 10)
|
||||
|
||||
@@ -42,6 +42,10 @@ func desanitize(actual, target *model.Config) {
|
||||
target.Office365Settings.Secret = actual.Office365Settings.Secret
|
||||
}
|
||||
|
||||
if target.OpenIdSettings.Secret != nil && *target.OpenIdSettings.Secret == model.FAKE_SETTING {
|
||||
target.OpenIdSettings.Secret = actual.OpenIdSettings.Secret
|
||||
}
|
||||
|
||||
if *target.SqlSettings.DataSource == model.FAKE_SETTING {
|
||||
*target.SqlSettings.DataSource = *actual.SqlSettings.DataSource
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ func TestDesanitize(t *testing.T) {
|
||||
actual.FileSettings.AmazonS3SecretAccessKey = sToP("amazon_s3_secret_access_key")
|
||||
actual.EmailSettings.SMTPPassword = sToP("smtp_password")
|
||||
actual.GitLabSettings.Secret = sToP("secret")
|
||||
actual.OpenIdSettings.Secret = sToP("secret")
|
||||
actual.SqlSettings.DataSource = sToP("data_source")
|
||||
actual.SqlSettings.AtRestEncryptKey = sToP("at_rest_encrypt_key")
|
||||
actual.ElasticsearchSettings.Password = sToP("password")
|
||||
@@ -46,6 +47,7 @@ func TestDesanitize(t *testing.T) {
|
||||
target.FileSettings.AmazonS3SecretAccessKey = sToP(model.FAKE_SETTING)
|
||||
target.EmailSettings.SMTPPassword = sToP(model.FAKE_SETTING)
|
||||
target.GitLabSettings.Secret = sToP(model.FAKE_SETTING)
|
||||
target.OpenIdSettings.Secret = sToP(model.FAKE_SETTING)
|
||||
target.SqlSettings.DataSource = sToP(model.FAKE_SETTING)
|
||||
target.SqlSettings.AtRestEncryptKey = sToP(model.FAKE_SETTING)
|
||||
target.ElasticsearchSettings.Password = sToP(model.FAKE_SETTING)
|
||||
@@ -66,6 +68,7 @@ func TestDesanitize(t *testing.T) {
|
||||
assert.Equal(t, *actual.FileSettings.AmazonS3SecretAccessKey, *target.FileSettings.AmazonS3SecretAccessKey)
|
||||
assert.Equal(t, *actual.EmailSettings.SMTPPassword, *target.EmailSettings.SMTPPassword)
|
||||
assert.Equal(t, *actual.GitLabSettings.Secret, *target.GitLabSettings.Secret)
|
||||
assert.Equal(t, *actual.OpenIdSettings.Secret, *target.OpenIdSettings.Secret)
|
||||
assert.Equal(t, *actual.SqlSettings.DataSource, *target.SqlSettings.DataSource)
|
||||
assert.Equal(t, *actual.SqlSettings.AtRestEncryptKey, *target.SqlSettings.AtRestEncryptKey)
|
||||
assert.Equal(t, *actual.ElasticsearchSettings.Password, *target.ElasticsearchSettings.Password)
|
||||
|
||||
Ссылка в новой задаче
Block a user