diff options
Diffstat (limited to 'lib/gitlab/auth/o_auth')
-rw-r--r-- | lib/gitlab/auth/o_auth/provider.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/auth/o_auth/user.rb | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/gitlab/auth/o_auth/provider.rb b/lib/gitlab/auth/o_auth/provider.rb index 1eae7af442d..57ff3fcd1f0 100644 --- a/lib/gitlab/auth/o_auth/provider.rb +++ b/lib/gitlab/auth/o_auth/provider.rb @@ -18,6 +18,8 @@ module Gitlab authenticator = case provider + when /crowd/ + Gitlab::Auth::Crowd::Authentication when /^ldap/ Gitlab::Auth::Ldap::Authentication when 'database' diff --git a/lib/gitlab/auth/o_auth/user.rb b/lib/gitlab/auth/o_auth/user.rb index 3211d2ffaea..f556a7f40e9 100644 --- a/lib/gitlab/auth/o_auth/user.rb +++ b/lib/gitlab/auth/o_auth/user.rb @@ -9,6 +9,16 @@ module Gitlab module Auth module OAuth class User + class << self + # rubocop: disable CodeReuse/ActiveRecord + def find_by_uid_and_provider(uid, provider) + identity = ::Identity.with_extern_uid(provider, uid).take + + identity && identity.user + end + # rubocop: enable CodeReuse/ActiveRecord + end + SignupDisabledError = Class.new(StandardError) SigninDisabledForProviderError = Class.new(StandardError) @@ -190,15 +200,12 @@ module Gitlab @auth_hash = AuthHash.new(auth_hash) end - # rubocop: disable CodeReuse/ActiveRecord def find_by_uid_and_provider - identity = Identity.with_extern_uid(auth_hash.provider, auth_hash.uid).take - identity&.user + self.class.find_by_uid_and_provider(auth_hash.uid, auth_hash.provider) end - # rubocop: enable CodeReuse/ActiveRecord - def build_new_user - user_params = user_attributes.merge(skip_confirmation: true) + def build_new_user(skip_confirmation: true) + user_params = user_attributes.merge(skip_confirmation: skip_confirmation) Users::BuildService.new(nil, user_params).execute(skip_authorization: true) end |