teambox/omniauth-ldap — pull request #3 by saimonmoore (2014-02-24 14:10:36+00:00)
Title: Add support for multiple connections

You can now configure multiple connections like so:

use OmniAuth::Strategies::LDAP,
:title => "My LDAP",
:host => ['10.101.10.1', '10.101.10.2'],
:port => [389, 389],
:method => [:plain, :plain],
:base => ['ou=int1, dc=intridea, dc=com', 'ou=int2, dc=intridea, dc=com'],
:uid => ['sAMAccountName', 'sAMAccountName'],
:name_proc => [Proc.new {|name| name.gsub(/@.*$/,'')}, nil],
:bind_dn => ['default_bind_dn', 'admin@intridea.com'],
# Or, alternatively:
#:filter => ['(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))', nil]
:password => ['password1', 'password2']

omniauth-ldap will then try each connection in order when trying to authenticate the user.

This feature allows you to search multiple domains/hosts, cases where bind_dn's exist in subtrees and multiple subtrees are needed.