diff options
Diffstat (limited to 'lib/gitlab/auth/ldap')
-rw-r--r-- | lib/gitlab/auth/ldap/access.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/adapter.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/auth_hash.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/authentication.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/config.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/dn.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/ldap_connection_error.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/person.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/auth/ldap/user.rb | 10 |
9 files changed, 40 insertions, 40 deletions
diff --git a/lib/gitlab/auth/ldap/access.rb b/lib/gitlab/auth/ldap/access.rb index 940b802be7e..98eec0e4a7b 100644 --- a/lib/gitlab/auth/ldap/access.rb +++ b/lib/gitlab/auth/ldap/access.rb @@ -6,14 +6,14 @@ # module Gitlab module Auth - module LDAP + module Ldap class Access - prepend_if_ee('::EE::Gitlab::Auth::LDAP::Access') # rubocop: disable Cop/InjectEnterpriseEditionModule + prepend_if_ee('::EE::Gitlab::Auth::Ldap::Access') # rubocop: disable Cop/InjectEnterpriseEditionModule attr_reader :provider, :user, :ldap_identity def self.open(user, &block) - Gitlab::Auth::LDAP::Adapter.open(user.ldap_identity.provider) do |adapter| + Gitlab::Auth::Ldap::Adapter.open(user.ldap_identity.provider) do |adapter| block.call(self.new(user, adapter)) end end @@ -50,7 +50,7 @@ module Gitlab end # Block user in GitLab if they were blocked in AD - if Gitlab::Auth::LDAP::Person.disabled_via_active_directory?(ldap_identity.extern_uid, adapter) + if Gitlab::Auth::Ldap::Person.disabled_via_active_directory?(ldap_identity.extern_uid, adapter) block_user(user, 'is disabled in Active Directory') false else @@ -62,7 +62,7 @@ module Gitlab block_user(user, 'does not exist anymore') false end - rescue LDAPConnectionError + rescue LdapConnectionError false end @@ -73,11 +73,11 @@ module Gitlab private def adapter - @adapter ||= Gitlab::Auth::LDAP::Adapter.new(provider) + @adapter ||= Gitlab::Auth::Ldap::Adapter.new(provider) end def ldap_config - Gitlab::Auth::LDAP::Config.new(provider) + Gitlab::Auth::Ldap::Config.new(provider) end def ldap_user @@ -87,7 +87,7 @@ module Gitlab end def find_ldap_user - Gitlab::Auth::LDAP::Person.find_by_dn(ldap_identity.extern_uid, adapter) + Gitlab::Auth::Ldap::Person.find_by_dn(ldap_identity.extern_uid, adapter) end def block_user(user, reason) diff --git a/lib/gitlab/auth/ldap/adapter.rb b/lib/gitlab/auth/ldap/adapter.rb index 356579ef402..c5ec4e1981b 100644 --- a/lib/gitlab/auth/ldap/adapter.rb +++ b/lib/gitlab/auth/ldap/adapter.rb @@ -2,9 +2,9 @@ module Gitlab module Auth - module LDAP + module Ldap class Adapter - prepend_if_ee('::EE::Gitlab::Auth::LDAP::Adapter') # rubocop: disable Cop/InjectEnterpriseEditionModule + prepend_if_ee('::EE::Gitlab::Auth::Ldap::Adapter') # rubocop: disable Cop/InjectEnterpriseEditionModule SEARCH_RETRY_FACTOR = [1, 1, 2, 3].freeze MAX_SEARCH_RETRIES = Rails.env.test? ? 1 : SEARCH_RETRY_FACTOR.size.freeze @@ -18,7 +18,7 @@ module Gitlab end def self.config(provider) - Gitlab::Auth::LDAP::Config.new(provider) + Gitlab::Auth::Ldap::Config.new(provider) end def initialize(provider, ldap = nil) @@ -27,7 +27,7 @@ module Gitlab end def config - Gitlab::Auth::LDAP::Config.new(provider) + Gitlab::Auth::Ldap::Config.new(provider) end def users(fields, value, limit = nil) @@ -75,7 +75,7 @@ module Gitlab renew_connection_adapter retry else - raise LDAPConnectionError, error_message + raise LdapConnectionError, error_message end end @@ -91,13 +91,13 @@ module Gitlab end entries.map do |entry| - Gitlab::Auth::LDAP::Person.new(entry, provider) + Gitlab::Auth::Ldap::Person.new(entry, provider) end end def user_options(fields, value, limit) options = { - attributes: Gitlab::Auth::LDAP::Person.ldap_attributes(config), + attributes: Gitlab::Auth::Ldap::Person.ldap_attributes(config), base: config.base } diff --git a/lib/gitlab/auth/ldap/auth_hash.rb b/lib/gitlab/auth/ldap/auth_hash.rb index 83fdc8a8c76..5435355f136 100644 --- a/lib/gitlab/auth/ldap/auth_hash.rb +++ b/lib/gitlab/auth/ldap/auth_hash.rb @@ -4,10 +4,10 @@ # module Gitlab module Auth - module LDAP + module Ldap class AuthHash < Gitlab::Auth::OAuth::AuthHash def uid - @uid ||= Gitlab::Auth::LDAP::Person.normalize_dn(super) + @uid ||= Gitlab::Auth::Ldap::Person.normalize_dn(super) end def username @@ -42,7 +42,7 @@ module Gitlab end def ldap_config - @ldap_config ||= Gitlab::Auth::LDAP::Config.new(self.provider) + @ldap_config ||= Gitlab::Auth::Ldap::Config.new(self.provider) end end end diff --git a/lib/gitlab/auth/ldap/authentication.rb b/lib/gitlab/auth/ldap/authentication.rb index 174e81dd603..d9964f237b1 100644 --- a/lib/gitlab/auth/ldap/authentication.rb +++ b/lib/gitlab/auth/ldap/authentication.rb @@ -8,10 +8,10 @@ module Gitlab module Auth - module LDAP + module Ldap class Authentication < Gitlab::Auth::OAuth::Authentication def self.login(login, password) - return unless Gitlab::Auth::LDAP::Config.enabled? + return unless Gitlab::Auth::Ldap::Config.enabled? return unless login.present? && password.present? # return found user that was authenticated by first provider for given login credentials @@ -22,7 +22,7 @@ module Gitlab end def self.providers - Gitlab::Auth::LDAP::Config.providers + Gitlab::Auth::Ldap::Config.providers end def login(login, password) @@ -33,7 +33,7 @@ module Gitlab ) return unless result - @user = Gitlab::Auth::LDAP::User.find_by_uid_and_provider(result.dn, provider) + @user = Gitlab::Auth::Ldap::User.find_by_uid_and_provider(result.dn, provider) end def adapter @@ -41,7 +41,7 @@ module Gitlab end def config - Gitlab::Auth::LDAP::Config.new(provider) + Gitlab::Auth::Ldap::Config.new(provider) end def user_filter(login) diff --git a/lib/gitlab/auth/ldap/config.rb b/lib/gitlab/auth/ldap/config.rb index 4bc0ceedae7..709cd0d787a 100644 --- a/lib/gitlab/auth/ldap/config.rb +++ b/lib/gitlab/auth/ldap/config.rb @@ -3,9 +3,9 @@ # Load a specific server configuration module Gitlab module Auth - module LDAP + module Ldap class Config - prepend_if_ee('::EE::Gitlab::Auth::LDAP::Config') # rubocop: disable Cop/InjectEnterpriseEditionModule + prepend_if_ee('::EE::Gitlab::Auth::Ldap::Config') # rubocop: disable Cop/InjectEnterpriseEditionModule NET_LDAP_ENCRYPTION_METHOD = { simple_tls: :simple_tls, diff --git a/lib/gitlab/auth/ldap/dn.rb b/lib/gitlab/auth/ldap/dn.rb index 0b496da784d..ea88dedadf5 100644 --- a/lib/gitlab/auth/ldap/dn.rb +++ b/lib/gitlab/auth/ldap/dn.rb @@ -21,7 +21,7 @@ # class also helps take care of that. module Gitlab module Auth - module LDAP + module Ldap class DN FormatError = Class.new(StandardError) MalformedError = Class.new(FormatError) diff --git a/lib/gitlab/auth/ldap/ldap_connection_error.rb b/lib/gitlab/auth/ldap/ldap_connection_error.rb index d0e5f24d203..13b0d29e104 100644 --- a/lib/gitlab/auth/ldap/ldap_connection_error.rb +++ b/lib/gitlab/auth/ldap/ldap_connection_error.rb @@ -2,8 +2,8 @@ module Gitlab module Auth - module LDAP - LDAPConnectionError = Class.new(StandardError) + module Ldap + LdapConnectionError = Class.new(StandardError) end end end diff --git a/lib/gitlab/auth/ldap/person.rb b/lib/gitlab/auth/ldap/person.rb index 88ec22aa75c..430f94a9a28 100644 --- a/lib/gitlab/auth/ldap/person.rb +++ b/lib/gitlab/auth/ldap/person.rb @@ -2,9 +2,9 @@ module Gitlab module Auth - module LDAP + module Ldap class Person - prepend_if_ee('::EE::Gitlab::Auth::LDAP::Person') # rubocop: disable Cop/InjectEnterpriseEditionModule + prepend_if_ee('::EE::Gitlab::Auth::Ldap::Person') # rubocop: disable Cop/InjectEnterpriseEditionModule # Active Directory-specific LDAP filter that checks if bit 2 of the # userAccountControl attribute is set. @@ -45,8 +45,8 @@ module Gitlab end def self.normalize_dn(dn) - ::Gitlab::Auth::LDAP::DN.new(dn).to_normalized_s - rescue ::Gitlab::Auth::LDAP::DN::FormatError => e + ::Gitlab::Auth::Ldap::DN.new(dn).to_normalized_s + rescue ::Gitlab::Auth::Ldap::DN::FormatError => e Rails.logger.info("Returning original DN \"#{dn}\" due to error during normalization attempt: #{e.message}") # rubocop:disable Gitlab/RailsLogger dn @@ -57,8 +57,8 @@ module Gitlab # 1. Excess spaces are stripped # 2. The string is downcased (for case-insensitivity) def self.normalize_uid(uid) - ::Gitlab::Auth::LDAP::DN.normalize_value(uid) - rescue ::Gitlab::Auth::LDAP::DN::FormatError => e + ::Gitlab::Auth::Ldap::DN.normalize_value(uid) + rescue ::Gitlab::Auth::Ldap::DN::FormatError => e Rails.logger.info("Returning original UID \"#{uid}\" due to error during normalization attempt: #{e.message}") # rubocop:disable Gitlab/RailsLogger uid @@ -103,7 +103,7 @@ module Gitlab attr_reader :entry def config - @config ||= Gitlab::Auth::LDAP::Config.new(provider) + @config ||= Gitlab::Auth::Ldap::Config.new(provider) end # Using the LDAP attributes configuration, find and return the first diff --git a/lib/gitlab/auth/ldap/user.rb b/lib/gitlab/auth/ldap/user.rb index 3b68230e193..df14e5fc3dc 100644 --- a/lib/gitlab/auth/ldap/user.rb +++ b/lib/gitlab/auth/ldap/user.rb @@ -8,10 +8,10 @@ # module Gitlab module Auth - module LDAP + module Ldap class User < Gitlab::Auth::OAuth::User extend ::Gitlab::Utils::Override - prepend_if_ee('::EE::Gitlab::Auth::LDAP::User') # rubocop: disable Cop/InjectEnterpriseEditionModule + prepend_if_ee('::EE::Gitlab::Auth::Ldap::User') # rubocop: disable Cop/InjectEnterpriseEditionModule class << self # rubocop: disable CodeReuse/ActiveRecord @@ -46,7 +46,7 @@ module Gitlab end def allowed? - Gitlab::Auth::LDAP::Access.allowed?(gl_user) + Gitlab::Auth::Ldap::Access.allowed?(gl_user) end def valid_sign_in? @@ -54,11 +54,11 @@ module Gitlab end def ldap_config - Gitlab::Auth::LDAP::Config.new(auth_hash.provider) + Gitlab::Auth::Ldap::Config.new(auth_hash.provider) end def auth_hash=(auth_hash) - @auth_hash = Gitlab::Auth::LDAP::AuthHash.new(auth_hash) + @auth_hash = Gitlab::Auth::Ldap::AuthHash.new(auth_hash) end end end |