DEV: If only one auth provider is enabled allow GET request

In this case, the auth provider is acting as a SSO provider, and can be trusted to maintain its own CSRF protections.
This commit is contained in:
David Taylor
2019-08-09 14:44:03 +01:00
parent d348368ab6
commit 1a8fee11a0
3 changed files with 16 additions and 4 deletions

View File

@ -146,6 +146,14 @@ RSpec.describe Users::OmniauthCallbacksController do
post "/auth/google_oauth2", params: { authenticity_token: token }
expect(response.status).to eq(302)
end
it "should not be CSRF protected if it is the only auth method" do
get "/auth/google_oauth2"
expect(response.status).to eq(200)
SiteSetting.enable_local_logins = false
get "/auth/google_oauth2"
expect(response.status).to eq(302)
end
end
end