public JetspeedUser getUser(Principal principal)
throws JetspeedSecurityException
{
BasicAttributes attr = new BasicAttributes();
Vector userurls = new Vector();
LDAPUser user = null;
try
{
userurls = JetspeedLDAP.search(JetspeedLDAP.buildURL("ou=users"),
"(&(uid="+principal.getName()+")(objectclass=jetspeeduser))", ATTRS, true);
}
catch (Exception e)
{
throw new UserException("Failed to retrieve user '" + principal.getName() + "'", e);
}
if (userurls.size() == 1)
{
user = new LDAPUser((LDAPURL) ((Vector)userurls.elementAt(0)).firstElement());
return user;
}
else if(userurls.size() > 1)
{
throw new UserException("Multiple Users with same username '" + principal.getName() + "'");