Skip to content
Snippets Groups Projects

Add support for LDAP failover

Merged Drew Blessing requested to merge dblessing/omniauth-ldap:ldap_failover into master
6 files
+ 78
16
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -13,10 +13,19 @@ module OmniAuth
@@ -13,10 +13,19 @@ module OmniAuth
class AuthenticationError < StandardError; end
class AuthenticationError < StandardError; end
class ConnectionError < StandardError; end
class ConnectionError < StandardError; end
VALID_ADAPTER_CONFIGURATION_KEYS = [:host, :port, :method, :bind_dn, :password, :try_sasl, :sasl_mechanisms, :uid, :base, :allow_anonymous, :filter]
VALID_ADAPTER_CONFIGURATION_KEYS = [
 
:hosts, :host, :port, :method, :bind_dn, :password, :try_sasl,
 
:sasl_mechanisms, :uid, :base, :allow_anonymous, :filter
 
]
# A list of needed keys. Possible alternatives are specified using sub-lists.
# A list of needed keys. Possible alternatives are specified using sub-lists.
MUST_HAVE_KEYS = [:host, :port, :method, [:uid, :filter], :base]
MUST_HAVE_KEYS = [
 
:base,
 
:method,
 
[:hosts, :host],
 
[:hosts, :port],
 
[:uid, :filter]
 
]
METHOD = {
METHOD = {
:ssl => :simple_tls,
:ssl => :simple_tls,
@@ -47,12 +56,12 @@ module OmniAuth
@@ -47,12 +56,12 @@ module OmniAuth
end
end
method = ensure_method(@method)
method = ensure_method(@method)
config = {
config = {
:host => @host,
base: @base,
:port => @port,
hosts: @hosts,
:encryption => method,
host: @host,
:base => @base
port: @port,
 
method: @method
}
}
@bind_method = @try_sasl ? :sasl : (@allow_anonymous||!@bind_dn||!@password ? :anonymous : :simple)
@bind_method = @try_sasl ? :sasl : (@allow_anonymous||!@bind_dn||!@password ? :anonymous : :simple)
Loading