Jun 3rd, 2010, 09:10 AM
Referrals and PageResultsRequestControl in Active Directory
We are trying to integrate with an Active Directory server and pull in users from the ldap server into our database.
What I would like to ideally do is, use the PageResultsRequestControl object and start searching the users from the base DN (the root dn of the ldap server.)
I would like to obtain results in increments of 100.
I use spring-ldap 1.2.1 and the ldapTemplate for looking up the users.
I use the method ldapTemplate.search(String name, String filter,SearchControls, ContextMapper, DirContextProcessor).
Now here is the issue, when I start searching from the base dn, if I set the referral to follow I get PartialResultsExceptions and don't get results back from the server. The PagedResultsRequestControl object the cookie value is null.
If I set the referral to throw , I get the LdapReferralException.
My question is, is there any way in Active Directory that referrals could be followed without me writing code for it.
Is there any way, I could sort of skip the referral and continue to the next result? Is there any sample code to either follow referrals or skip them.
Also can I use the PageResultsRequestControl in conjunction with all this.
What I want to do is that possible?
Currently to avoid referrals we look at a specific OU which contains all the users, but moving forward that is limited and customers would like to just start their base dn.
Any code samples will be appreciated.