From f9f7d28cdc6384423ccd84eff25000058f3e3e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C5=82gorzata=20Ksionek?= Date: Fri, 26 Apr 2019 22:19:35 +0200 Subject: Add omniauth-salesforce gem --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/controllers/omniauth_callbacks_controller.rb | 6 ++++-- lib/gitlab/request_forgery_protection.rb | 1 + spec/features/oauth_login_spec.rb | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 1282ff0e20d..1c77f8e9a8b 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ gem 'omniauth_crowd', '~> 2.2.0' gem 'omniauth-authentiq', '~> 0.3.3' gem 'omniauth_openid_connect', '~> 0.3.0' gem "omniauth-ultraauth", '~> 0.0.2' +gem 'omniauth-salesforce', '~> 1.0.5' gem 'rack-oauth2', '~> 1.9.3' gem 'jwt', '~> 2.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 9b1a036030a..ddff7e56968 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -553,6 +553,9 @@ GEM omniauth (~> 1.9) omniauth-oauth2-generic (0.2.2) omniauth-oauth2 (~> 1.0) + omniauth-salesforce (1.0.5) + omniauth (~> 1.0) + omniauth-oauth2 (~> 1.0) omniauth-saml (1.10.0) omniauth (~> 1.3, >= 1.3.2) ruby-saml (~> 1.7) @@ -1127,6 +1130,7 @@ DEPENDENCIES omniauth-google-oauth2 (~> 0.6.0) omniauth-kerberos (~> 0.3.0) omniauth-oauth2-generic (~> 0.2.2) + omniauth-salesforce (~> 1.0.5) omniauth-saml (~> 1.10) omniauth-shibboleth (~> 1.3.0) omniauth-twitter (~> 1.4) diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index d9b3b4bbbd9..1b60f4c83ed 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -125,12 +125,14 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def sign_in_user_flow(auth_user_class) auth_user = build_auth_user(auth_user_class) user = auth_user.find_and_update! + puts auth_user.valid_sign_in? + puts user.id if auth_user.valid_sign_in? log_audit_event(user, with: oauth['provider']) set_remember_me(user) - + puts user.two_factor_enabled? && !auth_user.bypass_two_factor? if user.two_factor_enabled? && !auth_user.bypass_two_factor? prompt_for_two_factor(user) else @@ -163,7 +165,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def fail_login(user) error_message = user.errors.full_messages.to_sentence - + puts error_message return redirect_to omniauth_error_path(oauth['provider'], error: error_message) end diff --git a/lib/gitlab/request_forgery_protection.rb b/lib/gitlab/request_forgery_protection.rb index b1e478093d3..4a6ed9aa6ac 100644 --- a/lib/gitlab/request_forgery_protection.rb +++ b/lib/gitlab/request_forgery_protection.rb @@ -18,6 +18,7 @@ module Gitlab end def index + puts 'here' head :ok end end diff --git a/spec/features/oauth_login_spec.rb b/spec/features/oauth_login_spec.rb index f4105730402..5ebfc32952d 100644 --- a/spec/features/oauth_login_spec.rb +++ b/spec/features/oauth_login_spec.rb @@ -14,7 +14,7 @@ describe 'OAuth Login', :js, :allow_forgery_protection do end providers = [:github, :twitter, :bitbucket, :gitlab, :google_oauth2, - :facebook, :cas3, :auth0, :authentiq] + :facebook, :cas3, :auth0, :authentiq, :salesforce] before(:all) do # The OmniAuth `full_host` parameter doesn't get set correctly (it gets set to something like `http://localhost` -- cgit v1.2.1