コード例 #1
0
 /**
  *
  * {@inheritDoc}
  * @see \Zend\Authentication\Storage\StorageInterface::write()
  */
 public function write($userId)
 {
     /*
      * run dependency check
      */
     $this->checkDependencies();
     /*
      * make sure we are not clobbering the
      * integrity of the session data by
      * clearing any existing data first
      */
     $this->clear();
     $em = $this->entityManager;
     $user = $em->getRepository('Acl\\Entity\\User')->find($userId);
     $session = clone $this->sessionPrototype;
     $session->setUser($user)->setExpires($this->getDefaultExpiresValue())->setIpAddress($this->getClientIpAddress());
     /*
      * go ahead and persist and flush to
      * generate the surrogate key for the session
      */
     $em->persist($session);
     $em->flush();
     /*
      * write session id to PHP session variable
      *
      * has to occur after the entity manager
      * is flush()-ed, otherwise there is no
      * surrogate key to keep up with
      */
     $this->container->write($session->getId());
 }
コード例 #2
0
 /**
  * 
  * @return Result
  */
 public function authenticate()
 {
     $this->adapter->setIdentity($this->identity);
     $this->adapter->setCredential($this->credential);
     $result = $this->adapter->authenticate();
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     if ($result->isValid()) {
         $this->storage->write($result->getIdentity());
         $this->triggerAuthenticationSuccessEvent($result);
     } else {
         $this->triggerAuthenticationFailureEvent($result);
     }
     return $result;
 }
コード例 #3
0
ファイル: DoctrineWrapper.php プロジェクト: patrova/omeka-s
 /**
  * {@inheritDoc}
  */
 public function write($identity)
 {
     $this->storage->write($identity->getId());
 }