Skip to content

support multiple connections

pyu10055 edited this page Jan 6, 2012 · 10 revisions

To support multiple connection on the same app, you can utilize the dynamic setup feature of omniauth. In the initializers/omniauth.rb add LDAP configuration as following:

provider :ldap, :setup => lambda {|env|
env['omniauth.strategy'].options[:host] = env['rack.session'][:host]
env['omniauth.strategy'].options[:port] = env['rack.session'][:port]
...
}

Your app need to populate the host and port or other necessary configurations in the env['rack.session'] on each request and callback phase.

For example, if you are supporting sub-domain, and each sub-domain is using a different ldap server or configuration, you can use above method to achieve that.

Clone this wiki locally