public String authenticate(String userID,String credential)
throws RegistryException
{
// a userID must be specified.
if (userID == null)
throw new UnknownUserException("Invalid user ID = "+userID);
// credential (password) must be specified.
if (credential == null)
throw new UnknownUserException("Invalid credentials");
if (userTable.containsKey(userID))
{
UserInfo userInfo = (UserInfo)userTable.get(userID);
if ((userInfo.password == null) || (!credential.equals(userInfo.password)))
throw new UnknownUserException("Invalid credentials");
}
else
throw new UnknownUserException("Invalid user ID: "+userID);
return userID;
}