mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 23:31:18 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user