Announcement Announcement Module
Collapse
No announcement yet.
search scope for lookup method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • search scope for lookup method

    Hello,

    I am using the ldaptemplate 1.0.2 with Microsoft ActiveDirectory Server.

    When I use the lookup method of ldaptemplate, I can't get any results. After using ethereal to analyse the LDAP request, I found out, that the lookup method always use search scope "Base (0x00)".

    How can I tell ldaptemplate to use scope "Subtree" during lookup?

    Thanks in advance

    Kanyin

    ====LDAP Request when calling lookup method===
    Base DN: CN=test,OU=myOrg,DC=myCompany,DC=com
    Scope: Base (0X00)
    Dereference: Always (0X03)
    Size Limit: 0
    Time Limit: 0
    Attributes Only: False
    Filter: (objectClass=*)

    =====My context source==================
    <beans>
    <bean id="contextSource" class="net.sf.ldaptemplate.support.LdapContextSour ce">
    <property name="url" value="ldap://myserver:389" />
    <property name="base" value="DC=test,DC=com" />
    <property name="userName" value="CN=testUser,CN=Users,DC=test,DC=com" />
    <property name="password" value="****" />
    <property name="dirObjectFactory" value="net.sf.ldaptemplate.support.DefaultDirObjec tFactory" />
    </bean>

    <bean id="ldapTemplate" class="net.sf.ldaptemplate.LdapTemplate">
    <constructor-arg ref="contextSource" />
    </bean>

    <bean id="ldapDao" class="com.test.LdapDaoImpl">
    <property name="ldapTemplate" ref="ldapTemplate" />
    </bean>
    </beans>

  • #2
    The lookup operation is a direct lookup, not a search, and as such it has no search scope. You supply the distinguished name of the entry you want to look up, relative to the base path you have specified for your ContextSource.

    I suspect that your problem is that your server requires an authenticated context for read-only operations. Try setting the authenticatedReadOnly property of your LdapContextSource to 'true' and double check that the distinguished name you are supplying is relative to the specified base context.

    Comment


    • #3
      thanks, it works now

      your are right. after setting the property, the lookup works just fine.

      thanks for the fast and helpful answer

      Kanyin

      Comment

      Working...
      X