This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

I'm not sure that I understand your problem. If I understand correctly you want to retrieve the 'uid' attribute of a specific entry, right? That's what your code seems to be doing.

When you execute the search using LdapTemplate all the attributes of the found entries are passed on to your AttributesMapper implementation. Your AttributesMapper handles the attributes you are interested in and the rest are just ignored. If you do want to handle the 'objectclass' attribute, do that in your AttributesMapper. That won't change the output in the LDAP server log, but I wouldn't worry about that.

Comment

My problem is I'm not getting any data back from ldaptemplate. When I make the same request (TAPexternalKey=320740168) in the gui, I get data back. The only difference I can see is the with gui I get attrs="objectClass" and ldtaptemplate I get attrs=ALL.

As I wrote that, I noticed that the other difference is the gui has quotes around the attrs value ("objectClasss") and ldaptemplate doesn't (ALL). Could that be the problem?

BTW - I'm using Sun LDAP.

Comment

It could be any number of things, but a wild guess could be that access control is playing a trick on you. If your LDAP server requires authentication for read-only access you'll need to set the authenticatedReadOnly property in your ContextSource to 'true'.

The log output suggests that the searches are identical, the 'attrs' shouldn't matter in this case.