criteria.addEqualTo("password", para.getParameter("password"));
final Query query = new QueryByCriteria(User.class, criteria);
final Collection c = broker.getCollectionByQuery(query);
if ( c.size() == 1 ) {
User u = (User)c.iterator().next();
PortalUser pUser = new PortalUser(u.getUsername());
pUser.setUid(u.getUid());
pUser.setFirstname(u.getFirstname());
pUser.setLastname(u.getLastname());
pUser.setPassword(u.getPassword());
pUser.setRole(u.getRole());
if ( this.getLogger().isInfoEnabled() ) {
this.getLogger().info("Loggedin as: " + u.getFirstname() + " " + u.getLastname() + " (" + u.getUsername() + " " + u.getRole() +")");
}
return pUser;
}
} finally {
broker.close();