use of com.iplanet.ums.User in project OpenAM by OpenRock.
the class DomainComponentTree method getUser.
/**
* Given identification of a user with a naming
* attribute and value, lookup the user under a virtual domain specified.
* For example,
*
* <pre>
* DomainComponentTree dctree = new DomainComponentTree(ctx,
* "red.iplanet.com");
*
* User user = dctree.getUser("cn", "Hin Man",
* "red.iplanet.com");
* </pre>
*
* @param namingAttribute
* Naming attribute for the user object such as "uid" or "mail".
* The naming attribute has to provide a unique identifier for
* the user.
* @param value
* attribute value for the naming attribute
* @param domain
* Fully qualified domain name such as "red.iplanet.com"
* @return User object if found
* @throws DomainNotFoundException
* if domain is not found
* @throws UMSException
* upon failure in instantiating the user object
* @supported.api
*/
public User getUser(String namingAttribute, String value, String domain) throws DomainNotFoundException, UMSException {
PersistentObject orgEntry = getOrganization(domain);
SearchResults result = orgEntry.search(namingAttribute + "=" + value, null);
return (User) result.assertOneEntry();
}
Aggregations