jQuery in Action, 2nd edition*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting the mail group from LDAP