當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::migrate方法代碼示例

本文整理匯總了PHP中Symfony\Component\HttpFoundation\Session\Session::migrate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::migrate方法的具體用法?PHP Session::migrate怎麽用?PHP Session::migrate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\HttpFoundation\Session\Session的用法示例。


在下文中一共展示了Session::migrate方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: logout

 /**
  * @param boolean $destroy
  *
  * @return boolean
  */
 public function logout($destroy = false)
 {
     if ($destroy === true) {
         $this->session->invalidate();
     } else {
         $this->session->remove(self::USER_ID);
         $this->session->remove(self::USER_NAME);
         $this->session->remove(self::USER_GROUPS);
         $this->session->migrate();
     }
     return !$this->isLogin();
 }
開發者ID:corpsee,項目名稱:nameless-source,代碼行數:17,代碼來源:User.php

示例2: migrate

 public function migrate($destroy = false, $lifetime = 86400)
 {
     parent::migrate($destroy, null);
     $session_id = $this->getId();
     cookie_remove('chestnut_session');
     cookie('chestnut_session', $session_id, $lifetime);
 }
開發者ID:leon723,項目名稱:chestnut,代碼行數:7,代碼來源:Session.php

示例3: regenerateId

 /**
  * Regenerates the session ID
  *
  * @return void
  */
 public function regenerateId()
 {
     if ($this->container instanceof WP_Session) {
         $this->container->regenerate_id();
     } else {
         $this->container->migrate();
     }
 }
開發者ID:bravadomizzou,項目名稱:dewdrop,代碼行數:13,代碼來源:Session.php

示例4: setUserLoggedIn

 /**
  * Set the user logged in
  * @param int $user_id
  * @param boolean $regenerate regenerate session id against session fixation?
  */
 protected function setUserLoggedIn($user_id, $regenerate = false)
 {
     if ($regenerate) {
         $this->session->migrate();
     }
     $this->session->set('user_id', $user_id);
     $this->session->set('user_logged_in', 1);
     // declare user id, set the login status to true
     $this->user_id = $user_id;
     $this->user_is_logged_in = true;
 }
開發者ID:khaidir,項目名稱:phpservermon,代碼行數:16,代碼來源:User.class.php

示例5: indexAction

 /**
  * @Route("/", name="homepage")
  */
 public function indexAction(Request $request)
 {
     $session = $request->getSession();
     if ($session == null) {
         $session = new Session();
     }
     if (!$session->isStarted()) {
         $session->start();
     }
     //new sessionID if session existed already.
     $session->migrate();
     if ($session->has('originalSessionID')) {
         $session->remove('originalSessionID');
     }
     return $this->render('default/index.html.twig');
 }
開發者ID:DanieleMenara,項目名稱:CreateSafe,代碼行數:19,代碼來源:DefaultController.php

示例6: applySessionStrategy

 /**
  * Apply the Session Strategy
  *
  * @return void
  */
 protected function applySessionStrategy()
 {
     if (!$this->session->isStarted()) {
         return $this->session->start();
     }
     switch ($this->strategy) {
         case self::STRATEGY_MIGRATE:
             $this->session->migrate();
             break;
         case self::STRATEGY_INVALIDATES:
             $this->session->invalidate();
             break;
         default:
             throw new \RuntimeException('Session strategy should be "migrate" or "invalidate"');
     }
 }
開發者ID:fwk,項目名稱:security,代碼行數:21,代碼來源:SessionStorage.php

示例7: handleEvent

 /**
  * @param GetResponseEvent $event
  */
 private function handleEvent(GetResponseEvent $event)
 {
     if ($this->tokenStorage->getToken()) {
         return;
     }
     if (!$this->samlInteractionProvider->isSamlAuthenticationInitiated()) {
         $this->sendAuthnRequest($event);
         return;
     }
     $expectedInResponseTo = $this->stateHandler->getRequestId();
     $logger = $this->logger;
     try {
         $assertion = $this->samlInteractionProvider->processSamlResponse($event->getRequest());
     } catch (PreconditionNotMetException $e) {
         $logger->notice(sprintf('SAML response precondition not met: "%s"', $e->getMessage()));
         $this->setPreconditionExceptionResponse($e, $event);
         return;
     } catch (Exception $e) {
         $logger->error(sprintf('Failed SAMLResponse Parsing: "%s"', $e->getMessage()));
         throw new AuthenticationException('Failed SAMLResponse parsing', 0, $e);
     }
     if (!InResponseTo::assertEquals($assertion, $expectedInResponseTo)) {
         $logger->error('Unknown or unexpected InResponseTo in SAMLResponse');
         throw new AuthenticationException('Unknown or unexpected InResponseTo in SAMLResponse');
     }
     $logger->notice('Successfully processed SAMLResponse, attempting to authenticate');
     $token = new SamlToken();
     $token->assertion = $assertion;
     try {
         $authToken = $this->authenticationManager->authenticate($token);
     } catch (AuthenticationException $failed) {
         $logger->error(sprintf('Authentication Failed, reason: "%s"', $failed->getMessage()));
         $this->setAuthenticationFailedResponse($event);
         return;
     }
     $this->tokenStorage->setToken($authToken);
     // migrate the session to prevent session hijacking
     $this->session->migrate();
     $event->setResponse(new RedirectResponse($this->stateHandler->getCurrentRequestUri()));
     $logger->notice('Authentication succeeded, redirecting to original location');
 }
開發者ID:OpenConext,項目名稱:OpenConext-profile,代碼行數:44,代碼來源:SamlListener.php

示例8: regenerateId

 /**
  * @return void
  */
 public function regenerateId()
 {
     $this->session->migrate();
 }
開發者ID:deltasystems,項目名稱:dewdrop,代碼行數:7,代碼來源:Access.php

示例9: migrate

 /**
  * {@inheritDoc}
  *
  * This method also regenerates a session token and persists
  * session container services
  *
  * @see persistServices()
  * @see parent::migrate()
  */
 public function migrate($destroy = false, $lifetime = null)
 {
     $lastSessionId = session_id();
     if (!$destroy) {
         $this->persistServices();
     }
     parent::migrate();
     if (!$destroy && !empty($lastSessionId)) {
         // regenerate token too
         $this->getToken(true);
         // keep old session id for reference
         $this->set('lastSessionId', $lastSessionId);
     }
 }
開發者ID:zenmagick,項目名稱:zenmagick,代碼行數:23,代碼來源:Session.php

示例10: regenerate

 /**
  * @return null
  */
 public function regenerate()
 {
     return parent::migrate(TRUE);
 }
開發者ID:middleout,項目名稱:arhitect-session,代碼行數:7,代碼來源:SymfonySession.php


注:本文中的Symfony\Component\HttpFoundation\Session\Session::migrate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。