views:

88

answers:

1

How to control LDAP Alias Dereferencing Mode using Java and Spring LDAP API? Similarly to how it is done using ldapsearch on linux.

Example:

ldapsearch -a never "(&(o=foo)(cn=bar))" cn
ldapsearch -a always "(&(o=foo)(cn=bar))" cn
A: 

I answer my own question.

The following does the job:

<bean id="ldapContextSource"
      class="org.springframework.ldap.core.support.LdapContextSource"
      p:url="${ldap.server.url}">
    <property name="baseEnvironmentProperties">
        <map>
            <entry key="java.naming.ldap.derefAliases" value="never"/>
        </map>
    </property>
</bean>
wajda