diff options
author | Chris Duarte <csduarte@users.noreply.github.com> | 2017-11-28 11:46:48 -0800 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-11-28 11:46:48 -0800 |
commit | 27ba68a7894d5204b8d75dc7353774977d62fa15 (patch) | |
tree | 28af6c0900a1967ee8145575daca57c76f781d79 /api4 | |
parent | 785a410936daff5db7fba07dc5735bd74dd158bb (diff) | |
download | chat-27ba68a7894d5204b8d75dc7353774977d62fa15.tar.gz chat-27ba68a7894d5204b8d75dc7353774977d62fa15.tar.bz2 chat-27ba68a7894d5204b8d75dc7353774977d62fa15.zip |
Add Config to disable Auth Transfers. (#7843)
* Add Config to disable Auth Transfers.
* Set config ExperimentalEnableAuthenticationTransfer behind an E20 license restriction
Diffstat (limited to 'api4')
-rw-r--r-- | api4/user_test.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/api4/user_test.go b/api4/user_test.go index 0c2b86eda..9c554da54 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -2117,6 +2117,57 @@ func TestSwitchAccount(t *testing.T) { t.Fatal("bad link") } + isLicensed := utils.IsLicensed() + license := utils.License() + enableAuthenticationTransfer := *th.App.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer + defer func() { + utils.SetIsLicensed(isLicensed) + utils.SetLicense(license) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = enableAuthenticationTransfer }) + }() + utils.SetIsLicensed(true) + utils.SetLicense(&model.License{Features: &model.Features{}}) + utils.License().Features.SetDefaults() + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false }) + + sr = &model.SwitchRequest{ + CurrentService: model.USER_AUTH_SERVICE_EMAIL, + NewService: model.USER_AUTH_SERVICE_GITLAB, + } + + _, resp = Client.SwitchAccountType(sr) + CheckForbiddenStatus(t, resp) + + th.LoginBasic() + + sr = &model.SwitchRequest{ + CurrentService: model.USER_AUTH_SERVICE_SAML, + NewService: model.USER_AUTH_SERVICE_EMAIL, + Email: th.BasicUser.Email, + NewPassword: th.BasicUser.Password, + } + + _, resp = Client.SwitchAccountType(sr) + CheckForbiddenStatus(t, resp) + + sr = &model.SwitchRequest{ + CurrentService: model.USER_AUTH_SERVICE_EMAIL, + NewService: model.USER_AUTH_SERVICE_LDAP, + } + + _, resp = Client.SwitchAccountType(sr) + CheckForbiddenStatus(t, resp) + + sr = &model.SwitchRequest{ + CurrentService: model.USER_AUTH_SERVICE_LDAP, + NewService: model.USER_AUTH_SERVICE_EMAIL, + } + + _, resp = Client.SwitchAccountType(sr) + CheckForbiddenStatus(t, resp) + + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = true }) + th.LoginBasic() fakeAuthData := model.NewId() |