Make authentication backwards compatible with multiple LDAP servers

Note: authentication agains an other server, other then the first
still does not work. This will be completed in further MR's
This commit is contained in:
Jan-Willem van der Meer
2014-10-09 08:54:55 +02:00
parent ddb46f48f3
commit 797ac2d60f
+7 -2
View File
@@ -45,11 +45,16 @@ module Gitlab
def find_by_uid(uid)
# LDAP distinguished name is case-insensitive
model.where("provider = ? and lower(extern_uid) = ?", provider, uid.downcase).last
model.
where(provider: [provider, :ldap]).
where('lower(extern_uid) = ?', uid.downcase).last
end
def provider
'ldap'
# Note: for backwards compatibility we just get the first provider
# Later on, we should loop through all servers until a successful
# authentication
Gitlab::LDAP::Config.servers.first.provider_name
end
end