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:
Diffstat (limited to 'lib/gitlab/auth')
-rw-r--r--lib/gitlab/auth/o_auth/auth_hash.rb2
-rw-r--r--lib/gitlab/auth/saml/auth_hash.rb2
-rw-r--r--lib/gitlab/auth/saml/config.rb36
-rw-r--r--lib/gitlab/auth/saml/user.rb2
4 files changed, 24 insertions, 18 deletions
diff --git a/lib/gitlab/auth/o_auth/auth_hash.rb b/lib/gitlab/auth/o_auth/auth_hash.rb
index d1eede65f0c..cce08750296 100644
--- a/lib/gitlab/auth/o_auth/auth_hash.rb
+++ b/lib/gitlab/auth/o_auth/auth_hash.rb
@@ -78,7 +78,7 @@ module Gitlab
def get_from_auth_hash_or_info(key)
if auth_hash.key?(key)
coerce_utf8(auth_hash[key])
- elsif auth_hash.key?(:extra) && auth_hash.extra.key?(:raw_info) && !auth_hash.extra.raw_info[key].nil?
+ elsif auth_hash.key?(:extra) && auth_hash.extra.key?(:raw_info) && !auth_hash.extra.raw_info[key].blank?
coerce_utf8(auth_hash.extra.raw_info[key])
else
get_info(key)
diff --git a/lib/gitlab/auth/saml/auth_hash.rb b/lib/gitlab/auth/saml/auth_hash.rb
index a2b0dfd5c66..592d88264e9 100644
--- a/lib/gitlab/auth/saml/auth_hash.rb
+++ b/lib/gitlab/auth/saml/auth_hash.rb
@@ -5,7 +5,7 @@ module Gitlab
module Saml
class AuthHash < Gitlab::Auth::OAuth::AuthHash
def groups
- Array.wrap(get_raw(Gitlab::Auth::Saml::Config.groups))
+ Array.wrap(get_raw(Gitlab::Auth::Saml::Config.new(auth_hash.provider).groups))
end
def authn_context
diff --git a/lib/gitlab/auth/saml/config.rb b/lib/gitlab/auth/saml/config.rb
index 815130aeee2..7524d8b9f85 100644
--- a/lib/gitlab/auth/saml/config.rb
+++ b/lib/gitlab/auth/saml/config.rb
@@ -8,26 +8,32 @@ module Gitlab
def enabled?
::AuthHelper.saml_providers.any?
end
+ end
- def options
- Gitlab::Auth::OAuth::Provider.config_for('saml')
- end
+ DEFAULT_PROVIDER_NAME = 'saml'
- def upstream_two_factor_authn_contexts
- options.args[:upstream_two_factor_authn_contexts]
- end
+ def initialize(provider = DEFAULT_PROVIDER_NAME)
+ @provider = provider
+ end
- def groups
- options[:groups_attribute]
- end
+ def options
+ Gitlab::Auth::OAuth::Provider.config_for(@provider)
+ end
- def external_groups
- options[:external_groups]
- end
+ def upstream_two_factor_authn_contexts
+ options.args[:upstream_two_factor_authn_contexts]
+ end
- def admin_groups
- options[:admin_groups]
- end
+ def groups
+ options[:groups_attribute]
+ end
+
+ def external_groups
+ options[:external_groups]
+ end
+
+ def admin_groups
+ options[:admin_groups]
end
end
end
diff --git a/lib/gitlab/auth/saml/user.rb b/lib/gitlab/auth/saml/user.rb
index d14da41deb6..6f72f185c8d 100644
--- a/lib/gitlab/auth/saml/user.rb
+++ b/lib/gitlab/auth/saml/user.rb
@@ -43,7 +43,7 @@ module Gitlab
protected
def saml_config
- Gitlab::Auth::Saml::Config
+ Gitlab::Auth::Saml::Config.new(auth_hash.provider)
end
def auto_link_saml_user?