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-03-13 09:09:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 09:09:37 +0300
commit0301a0cad0063d76b1607358dc6c711ea043fdda (patch)
tree894ac424a6fb370ad8dc5de4294cdc87f0ae164e /spec/initializers
parentdcce066c5059c4df112dce4a9edf288d74aec48b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers')
-rw-r--r--spec/initializers/100_patch_omniauth_saml_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/initializers/100_patch_omniauth_saml_spec.rb b/spec/initializers/100_patch_omniauth_saml_spec.rb
new file mode 100644
index 00000000000..c4d20f79af0
--- /dev/null
+++ b/spec/initializers/100_patch_omniauth_saml_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'OmniAuth::Strategies::SAML', type: :strategy do
+ let(:idp_sso_target_url) { 'https://login.example.com/idp' }
+ let(:strategy) { [OmniAuth::Strategies::SAML, { idp_sso_target_url: idp_sso_target_url }] }
+
+ describe 'POST /users/auth/saml' do
+ it 'redirects to the provider login page' do
+ post '/users/auth/saml'
+
+ expect(last_response).to redirect_to(/\A#{Regexp.quote(idp_sso_target_url)}/)
+ end
+
+ it 'stores request ID during request phase' do
+ request_id = double
+ allow_next_instance_of(OneLogin::RubySaml::Authrequest) do |instance|
+ allow(instance).to receive(:uuid).and_return(request_id)
+ end
+
+ post '/users/auth/saml'
+ expect(session['last_authn_request_id']).to eq(request_id)
+ end
+ end
+end