diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 18:07:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 18:07:32 +0300 |
commit | cda3f6ca486cd392ce523157ee08692e106fc85d (patch) | |
tree | 8921da94b2a59c8eed9ef9e26893a4b0ee26a9af /lib/gitlab | |
parent | 27d427e538fa9c7cb6ca39637660a63f24d7f2d8 (diff) |
Add latest changes from gitlab-org/gitlab@16-6-stable-ee
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/auth/saml/config.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/omniauth_initializer.rb | 11 |
2 files changed, 1 insertions, 25 deletions
diff --git a/lib/gitlab/auth/saml/config.rb b/lib/gitlab/auth/saml/config.rb index e6c9f04eff5..7524d8b9f85 100644 --- a/lib/gitlab/auth/saml/config.rb +++ b/lib/gitlab/auth/saml/config.rb @@ -8,21 +8,6 @@ module Gitlab def enabled? ::AuthHelper.saml_providers.any? end - - def default_attribute_statements - defaults = OmniAuth::Strategies::SAML.default_options[:attribute_statements].to_hash.deep_symbolize_keys - defaults[:nickname] = %w[username nickname] - defaults[:name] << 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name' - defaults[:name] << 'http://schemas.microsoft.com/ws/2008/06/identity/claims/name' - defaults[:email] << 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress' - defaults[:email] << 'http://schemas.microsoft.com/ws/2008/06/identity/claims/emailaddress' - defaults[:first_name] << 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname' - defaults[:first_name] << 'http://schemas.microsoft.com/ws/2008/06/identity/claims/givenname' - defaults[:last_name] << 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname' - defaults[:last_name] << 'http://schemas.microsoft.com/ws/2008/06/identity/claims/surname' - - defaults - end end DEFAULT_PROVIDER_NAME = 'saml' diff --git a/lib/gitlab/omniauth_initializer.rb b/lib/gitlab/omniauth_initializer.rb index 0bcd5b1196a..81ad7a7f9e1 100644 --- a/lib/gitlab/omniauth_initializer.rb +++ b/lib/gitlab/omniauth_initializer.rb @@ -29,8 +29,6 @@ module Gitlab { authorize_params: { gl_auth_type: 'login' } } - when ->(provider_name) { AuthHelper.saml_providers.include?(provider_name.to_sym) } - { attribute_statements: ::Gitlab::Auth::Saml::Config.default_attribute_statements } else {} end @@ -63,7 +61,7 @@ module Gitlab provider_arguments.concat arguments provider_arguments << defaults unless defaults.empty? when Hash, GitlabSettings::Options - hash_arguments = merge_hash_defaults_and_args(defaults, arguments) + hash_arguments = arguments.deep_symbolize_keys.deep_merge(defaults) normalized = normalize_hash_arguments(hash_arguments) # A Hash from the configuration will be passed as is. @@ -82,13 +80,6 @@ module Gitlab provider_arguments end - def merge_hash_defaults_and_args(defaults, arguments) - return arguments.to_hash if defaults.empty? - return defaults.deep_merge(arguments.deep_symbolize_keys) if Feature.enabled?(:invert_omniauth_args_merging) - - arguments.to_hash.deep_symbolize_keys.deep_merge(defaults) - end - def normalize_hash_arguments(args) args.deep_symbolize_keys! |