Results 1 to 3 of 3

Thread: search scope for lookup method

  1. #1
    Join Date
    Aug 2006
    Posts
    4

    Default 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. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    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.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    Aug 2006
    Posts
    4

    Thumbs up thanks, it works now

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

    thanks for the fast and helpful answer

    Kanyin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •