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
parent ddb46f48
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment