Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-08 21:07:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-08 21:07:32 +0300
commit73391dcc368ef846c2960c1d0ef5e64ca78e1bee (patch)
treeb111bca95c5a4e45318eb85a238c7916340efff2 /spec/controllers/omniauth_callbacks_controller_spec.rb
parenta7df1d8717d39424ced032d9fe063f08f97e19d6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/omniauth_callbacks_controller_spec.rb')
-rw-r--r--spec/controllers/omniauth_callbacks_controller_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb
index 6c5f36804e8..8b92976252c 100644
--- a/spec/controllers/omniauth_callbacks_controller_spec.rb
+++ b/spec/controllers/omniauth_callbacks_controller_spec.rb
@@ -287,6 +287,34 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
request.env['omniauth.auth'] = Rails.application.env_config['omniauth.auth']
end
+ context 'sign up' do
+ before do
+ user.destroy
+ end
+
+ it 'denies login if sign up is enabled, but block_auto_created_users is set' do
+ post :saml, params: { SAMLResponse: mock_saml_response }
+
+ expect(flash[:alert]).to start_with 'Your account has been blocked.'
+ end
+
+ it 'accepts login if sign up is enabled' do
+ stub_omniauth_setting(block_auto_created_users: false)
+
+ post :saml, params: { SAMLResponse: mock_saml_response }
+
+ expect(request.env['warden']).to be_authenticated
+ end
+
+ it 'denies login if sign up is not enabled' do
+ stub_omniauth_setting(allow_single_sign_on: false, block_auto_created_users: false)
+
+ post :saml, params: { SAMLResponse: mock_saml_response }
+
+ expect(flash[:alert]).to start_with 'Signing in using your saml account without a pre-existing GitLab account is not allowed.'
+ end
+ end
+
context 'with GitLab initiated request' do
before do
post :saml, params: { SAMLResponse: mock_saml_response }