Announcement Announcement Module
Collapse
No announcement yet.
Multiple LDAP Urls Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple LDAP Urls

    Hi, I have successfully got things working with one of my servers. Now I'm trying to hit multiple ldap servers and having no luck.

    Here is my spring context:

    Code:
       <!-- Define the ldap context source -->
        <bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource">
            <property name="urls" value="ldap://10.71.200.11:389, ldap://10.91.200.11:389"/>
            <property name="authenticationSource" ref="authenticationSource"/>
        </bean>
    
        <!-- Define our authentication source -->
        <bean id="authenticationSource"
              class="org.springframework.ldap.support.authentication.DefaultValuesAuthenticationSourceDecorator">
            <property name="target" ref="threadLocalAuthenticationSource"/>
            <property name="defaultUser" value="manager"/>
            <property name="defaultPassword" value="secret"/>
        </bean>
    
        <bean id="threadLocalAuthenticationSource" class="com.edlending.spring.ThreadLocalAuthenticationSource"/>
    
        <!-- Define the LdapTemplate -->
        <bean id="ldapOperations" class="org.springframework.ldap.LdapTemplate">
            <constructor-arg ref="contextSource"/>
            <property name="ignorePartialResultException" value="true"/>
        </bean>
    Am I doing something wrong with my urls property of the contextSource?

    Thanks in advance.

  • #2
    The configuration looks ok to me. What happens (i.e. are you getting a stack trace or is there something else going wrong)?

    Comment


    • #3
      No stack trace, just not getting the results I expect.

      For example, if I do a search for a person based on a unique attribute when I only have 1 url specified the result is as expected. However when I add the 2nd URL the first search no longer works.

      I apologize as I have not looked into implementation details, but I expected that the search would search both LDAP trees in this case.

      Thanks,
      Bryan

      Comment


      • #4
        I'm afraid that's not the way it works. The use of multiple urls is described in Sun's ldap tutorial:
        Instead of just one URL, you can also supply a space-separated list of URLs. In this case, the LDAP provider will attempt to use each URL in turn until it is able to create a successful connection. The LDAP provider will then set the Context.PROVIDER_URL property to the successful URL, so that the application can determine which URL is being used.
        It's mostly useful for ensuring access to an LDAP server when you have a number of mirrored servers and don't care which one you connect to.

        Comment


        • #5
          Gotcha thanks.

          Comment

          Working...
          X