File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes How to get all the groups assigned to a user from AD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How to get all the groups assigned to a user from AD" Watch "How to get all the groups assigned to a user from AD" New topic
Author

How to get all the groups assigned to a user from AD

Puneet pun
Greenhorn

Joined: Apr 22, 2014
Posts: 1
Hi All,

I am trying to get list of groups assigned to the user from AD. I have tested a query in AD tool and it seems to be working but not when triggered via the code.

Any pointers??

LDAP query worked from AD tool:
(&(objectClass=group)(member=CN=test,OU=People,DC=corp,DC=XXX,DC=org))

Through code:

String searchFilter = "(&(objectClass=group)(member=CN=test,OU=People,DC=corp,DC=XXX,DC=org))"
String searchBase = "DC=XXX,DC=org";

SearchControls searchCtls = new SearchControls();
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration answer = context.search(searchBase, searchFilter, searchCtls);

Its not returning any result and is getting timed out.

Also , we dont have memberOf attribute in the user attributes.

Thanks.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get all the groups assigned to a user from AD