diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 18:36:26 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 18:36:26 +0000 |
commit | 040e6e72bfc0a40c0a133d07a4619597cf6b4675 (patch) | |
tree | b43b938c91a465b8bc55ac00e5bcabe3a7f21e8a /spec/support | |
parent | 4c887a1975e453afe27e536d73175e2d89f6a8b5 (diff) | |
parent | 104c8b890dbca25a0d08b2567d003f02953a0fc1 (diff) | |
download | gitlab-ce-040e6e72bfc0a40c0a133d07a4619597cf6b4675.tar.gz |
Merge branch 'ce-security-jej/group-saml-link-origin-verification' into 'master'
Ensure request to link GroupSAML acount was GitLab initiated
See merge request gitlab/gitlabhq!2976
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/login_helpers.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index 3fee6872498..4a0cf62a661 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -47,7 +47,7 @@ module LoginHelpers end def gitlab_sign_in_via(provider, user, uid, saml_response = nil) - mock_auth_hash(provider, uid, user.email, saml_response) + mock_auth_hash_with_saml_xml(provider, uid, user.email, saml_response) visit new_user_session_path click_link provider end @@ -87,7 +87,12 @@ module LoginHelpers click_link "oauth-login-#{provider}" end - def mock_auth_hash(provider, uid, email, saml_response = nil) + def mock_auth_hash_with_saml_xml(provider, uid, email, saml_response) + response_object = { document: saml_xml(saml_response) } + mock_auth_hash(provider, uid, email, response_object: response_object) + end + + def mock_auth_hash(provider, uid, email, response_object: nil) # The mock_auth configuration allows you to set per-provider (or default) # authentication hashes to return during integration testing. OmniAuth.config.mock_auth[provider.to_sym] = OmniAuth::AuthHash.new({ @@ -110,9 +115,7 @@ module LoginHelpers image: 'mock_user_thumbnail_url' } }, - response_object: { - document: saml_xml(saml_response) - } + response_object: response_object } }) Rails.application.env_config['omniauth.auth'] = OmniAuth.config.mock_auth[provider.to_sym] |