FEATURE: Add a site setting to control automatic auth redirect (#10732)

This allows administrators to stop automatic redirect to an external authenticator. It only takes effect when there is a single authentication method, and the site is login_required
This commit is contained in:
David Taylor
2020-09-24 17:06:07 +01:00
committed by GitHub
parent 6a5aeceee8
commit f1d64bbbe5
4 changed files with 23 additions and 2 deletions

View File

@ -45,6 +45,24 @@ RSpec.describe ApplicationController do
expect(response).to redirect_to("/login")
end
it "should not redirect to SSO when external_auth_immediately is disabled" do
SiteSetting.external_auth_immediately = false
SiteSetting.sso_url = 'http://someurl.com'
SiteSetting.enable_sso = true
get "/"
expect(response).to redirect_to("/login")
end
it "should not redirect to authenticator when external_auth_immediately is disabled" do
SiteSetting.external_auth_immediately = false
SiteSetting.enable_google_oauth2_logins = true
SiteSetting.enable_local_logins = false
get "/"
expect(response).to redirect_to("/login")
end
context "with omniauth in test mode" do
before do
OmniAuth.config.test_mode = true