File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes Getting the mail group from LDAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Getting the mail group from LDAP" Watch "Getting the mail group from LDAP" New topic
Author

Getting the mail group from LDAP

Shamu Somasundaram
Ranch Hand

Joined: Aug 25, 2004
Posts: 41
Hi All,
In our application, Useers are authenticated from LDAP. LDAP will return me the user id of the logged in user after authentication. Infact I am using personppidx attribute to get the user id of the logged in person.
Now, If the logged in user belongs to some lotus mail group in LDAP, how will I get the mail group the user belongs to from my Java class.

My cosde for getting the user id goes like this.

NamingEnumeration enum = ctx.search("","uid="+userName,new SearchControls(SearchControls.SUBTREE_SCOPE,0,0,null,true,true));

while(enum.hasMoreElements())
{
Attributes attrs = ((SearchResult)enum.next()).getAttributes();
}
while(enum.hasMoreElements()){
Attributes attrs = ((SearchResult)enum.next()).getAttributes();
Attribute attr = attrs.get("personppidx");
if(attr != null)
ppidx = (String) attr.get(0);

if(ppidx == null){
enum = ctx.search("","cn="+userName,new SearchControls(SearchControls.SUBTREE_SCOPE,0,0,null,true,true));

while(enum.hasMoreElements()){
Attributes attrs = ((SearchResult)enum.next()).getAttributes();
if(attrs != null){
Attribute attr = attrs.get("personppidx");
if(attr != null)
ppidx = (String) attr.get(0);
}


}
}

so ppidx returns me the user id.
But I'm not finding any attributes giving me the details whether the user belongs to a mail group or not.
Please suggest me some ways to get the details of the mail gropu the person belongs to.

Thanks in advance.
Shanmugavel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the mail group from LDAP