示例#1
0
 public function logout()
 {
     if ($this->authService->hasIdentity()) {
         $this->authService->clearIdentity();
         $this->sessionManager->forgetMe();
     }
 }
示例#2
0
 /**
  * @param AuthenticationEvent $e
  */
 public function authListener(AuthenticationEvent $e)
 {
     $result = $e->getResult();
     if ($result->isValid()) {
         if ($this->rememberMe) {
             $this->sessionManager->rememberMe();
         } else {
             $this->sessionManager->forgetMe();
         }
         $this->sessionManager->writeClose();
     }
 }
示例#3
0
 public function logoutAction()
 {
     $auth = new AuthenticationService();
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         $auth->clearIdentity();
         $sessionManager = new SessionManager();
         $sessionManager->forgetMe();
     }
     $this->redirect()->toRoute('backend_login');
 }
 /**
  * Log out action
  *
  * The method destroys session for a logged user
  *
  * @return redirect to specific action
  */
 public function logoutAction()
 {
     $auth = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService');
     if ($auth->hasIdentity()) {
         $auth->clearIdentity();
         $sessionManager = new SessionManager();
         $sessionManager->forgetMe();
     }
     return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute());
 }
示例#5
0
 public function logoutAction()
 {
     $auth = new AuthenticationService();
     $auth->clearIdentity();
     $sessionManager = new SessionManager();
     $sessionManager->forgetMe();
     return $this->redirect()->toRoute('user-auth');
 }
 public function logoutAction()
 {
     $auth = $this->authService;
     if ($auth->hasIdentity()) {
         $auth->clearIdentity();
         // remove user data
         $userContainer = new Container('User');
         $userContainer->getManager()->getStorage()->clear('User');
         // forget-me
         $sessionManager = new SessionManager();
         $sessionManager->forgetMe();
     }
     return $this->redirect()->toRoute('authentication/login');
 }
示例#7
0
 /**
  */
 public function logoutAction()
 {
     $loSession = new Session();
     $loIdentity = $loSession->getRegister('OnionAuth');
     //$loAuth = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService');
     //if ($loAuth->hasIdentity())
     if (is_object($loIdentity)) {
         //$loIdentity = $loAuth->getIdentity();
         Debug::debug('[THERE IS IDENTITY]');
         Access::log($loIdentity, "LOGOUT");
     }
     //$loAuth->clearIdentity();
     $loSession = new Session();
     $loSession->clearRegister('OnionAuth');
     $loSession->clearRegister('storage', 'Zend_Auth');
     $loSessionManager = new SessionManager();
     $loSessionManager->forgetMe();
     Debug::debug('[LOGOUT]');
     return $this->redirect()->toRoute('application', array('controller' => 'application', 'action' => 'index'));
 }
 /**
  * Retorna o adaptador de sessao
  * @param string $name
  * @return SessionContainer
  */
 public function getSessionAdapter($name = 'Default')
 {
     if (!isset($_SESSION[$name])) {
         $sessionConfig = new SessionConfig();
         $sessionConfig->setOptions($this->globalConfig['session']);
         $sessionStorage = new \Zend\Session\Storage\SessionArrayStorage();
         $sessionManager = new SessionManager();
         $sessionManager->rememberMe($this->globalConfig['session']['remember_me_seconds']);
         $sessionManager->forgetMe();
         $sessionManager->setConfig($sessionConfig);
         $sessionManager->setStorage($sessionStorage);
         $sessionNamespace = new SessionContainer($name, $sessionManager);
         $sessionNamespace->setExpirationSeconds(3600);
         if (!isset($sessionNamespace->init)) {
             $request = new \Zend\Http\PhpEnvironment\Request();
             $sessionNamespace->init = 1;
             $sessionNamespace->remoteAddr = $request->getServer('REMOTE_ADDR');
             $sessionNamespace->httpUserAgent = $request->getServer('HTTP_USER_AGENT');
             /*
              $chain = $sessionManager->getValidatorChain();
              $validatorUserAgent = new \Zend\Session\Validator\HttpUserAgent($sessionNamespace->httpUserAgent);
              $chain->attach('session.validate', array($validatorUserAgent, 'isValid'));
              $validatorAddr = new \Zend\Session\Validator\RemoteAddr($sessionNamespace->remoteAddr);
              $chain->attach('session.validate', array($validatorAddr, 'isValid'));
             
              $sessionManager->setValidatorChain($chain);
             * 
             */
         }
         $sessionNamespace->setDefaultManager($sessionManager);
     } else {
         $sessionNamespace = new SessionContainer($name);
         $sessionNamespace->setExpirationSeconds(3600);
     }
     $this->sessionAdapter = $sessionNamespace;
     return $sessionNamespace;
 }
示例#9
0
 public function logoutAction()
 {
     $auth = new AuthenticationService();
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         $this->getLoginTable()->deleteSession($identity->username);
     }
     $auth->clearIdentity();
     $session_manager = new SessionManager();
     $session_manager->forgetMe();
     return $this->redirect()->toUrl('/login/log');
 }