当前位置: 首页>>代码示例>>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;未经允许,请勿转载。