This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the mail group from LDAP
 
Similar Threads
Query for "ACTIVE" users in LDAP server NOT working
LDAP question on syntax in search filter
return false or raise exception?
how to get ldap list of users belongs to a group using java
Problem with Return type for LDAP Search