/**
  * (non-PHPdoc)
  * @see \Zend\Authentication\Adapter\AdapterInterface::authenticate()
  */
 public function authenticate()
 {
     $repository = $this->em->getRepository('VMBLogin\\Entity\\User');
     $this->user = $repository->findOneByUserUsername($this->getUsername());
     if ($this->user) {
         if ($this->user->getUserPassword() == $this->user->encryptPassword($this->getPassword())) {
             return new Result(Result::SUCCESS, array('user' => $this->user), array('ok'));
         }
         return new Result(Result::FAILURE_CREDENTIAL_INVALID, null, array());
     }
     return new Result(Result::FAILURE_CREDENTIAL_INVALID, null, array());
 }