Spring Security with two LDAP servers

Tag: spring-security , spring-ldap Author: xiadao521 Date: 2013-04-16

Out corporate network is set up with different Active Directory / LDAP servers, one server per each location.

Example:

Germany: ldap://ldapserver1.germany.corp.domain/DC=germany,DC=corp,DC=domain
Amerika: ldap://ldapserver2.america.corp.domain/DC=america,DC=corp,DC=domain

As I only can find american users in the american LDAP server (to authenticate), we have to configure multiple servers with multiple DC's.

Is it possible to configure such a setup with Spring Security LDAP?

You could setup two LdapAuthenticationProvider beans, one for each domain and they will be tried in turn. How do you handle username conflicts between the two servers? It might help if you spell out the use case in more detail. Do you want users to select a specific country when they log in?
This is a really good hint to use multiple AuthenticationProviders. That seems to work. But: Is there also a way to do this with LdapTemplates?
Sorry, I don't see why LdapTemplate is relevant.