当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionInterface::getName方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::getName方法的具体用法?PHP SessionInterface::getName怎么用?PHP SessionInterface::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\Session\SessionInterface的用法示例。


在下文中一共展示了SessionInterface::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_logs_user_out(SessionInterface $session, CookieSetterInterface $cookieSetter)
 {
     $session->set('_security_shop', null)->shouldBeCalled();
     $session->save()->shouldBeCalled();
     $session->getName()->willReturn('MOCKEDSID');
     $session->getId()->willReturn('xyzc123');
     $cookieSetter->setCookie('MOCKEDSID', 'xyzc123')->shouldBeCalled();
     $this->logOut();
 }
开发者ID:loic425,项目名称:Sylius,代码行数:9,代码来源:SecurityServiceSpec.php

示例2: logInUser

 /**
  * @param UserInterface $user
  */
 private function logInUser(UserInterface $user)
 {
     $token = new UsernamePasswordToken($user, $user->getPassword(), 'randomstringbutnotnull', $user->getRoles());
     $this->session->set($this->sessionTokenVariable, serialize($token));
     $this->session->save();
     $this->cookieSetter->setCookie($this->session->getName(), $this->session->getId());
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:10,代码来源:SecurityService.php

示例3: testSetName

 public function testSetName()
 {
     $this->assertEquals('MOCKSESSID', $this->session->getName());
     $this->session->setName('session.test.com');
     $this->session->start();
     $this->assertEquals('session.test.com', $this->session->getName());
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:7,代码来源:SessionTest.php

示例4: generateCookie

 protected function generateCookie()
 {
     $lifetime = $this->options->getInt('cookie_lifetime');
     if ($lifetime !== 0) {
         $lifetime += time();
     }
     return new Cookie($this->session->getName(), $this->session->getId(), $lifetime, $this->options['cookie_path'], $this->options['cookie_domain'] ?: null, $this->options->getBoolean('cookie_secure'), $this->options->getBoolean('cookie_httponly'));
 }
开发者ID:nbehier,项目名称:bolt,代码行数:8,代码来源:SessionListener.php

示例5: writeSessionTo

 /**
  * Write the session cookie to the response.
  *
  * @param \Symfony\Component\HttpFoundation\Response $response
  * @return void
  */
 protected function writeSessionTo(Response $response)
 {
     // TODO: Take these values from config
     $lifetime = Carbon::now()->addMinutes(120);
     $path = '/';
     $domain = null;
     $secure = false;
     $response->headers->setCookie(new Cookie($this->session->getName(), $this->session->getId(), $lifetime, $path, $domain, $secure));
 }
开发者ID:fluxbb,项目名称:core,代码行数:15,代码来源:SessionKernel.php

示例6: onSiteAccessMatch

 public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
 {
     if (!($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST && isset($this->session) && !$this->session->isStarted() && $this->sessionStorage instanceof NativeSessionStorage)) {
         return;
     }
     $sessionOptions = (array) $this->configResolver->getParameter('session');
     $sessionName = isset($sessionOptions['name']) ? $sessionOptions['name'] : $this->session->getName();
     $sessionOptions['name'] = $this->getSessionName($sessionName, $event->getSiteAccess());
     $this->sessionStorage->setOptions($sessionOptions);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:10,代码来源:SessionSetDynamicNameListener.php

示例7: logIn

 /**
  * {@inheritdoc}
  */
 public function logIn($email, $providerKey, Session $minkSession)
 {
     $user = $this->userRepository->findOneBy(['username' => $email]);
     if (null === $user) {
         throw new \InvalidArgumentException(sprintf('There is no user with email %s', $email));
     }
     $token = new UsernamePasswordToken($user, $user->getPassword(), $providerKey, $user->getRoles());
     $this->session->set('_security_user', serialize($token));
     $this->session->save();
     $minkSession->setCookie($this->session->getName(), $this->session->getId());
 }
开发者ID:Mangetsu,项目名称:Sylius,代码行数:14,代码来源:SecurityService.php

示例8: getConfig

 public function getConfig()
 {
     $sessionInfo = ['isStarted' => false];
     if ($this->session->isStarted()) {
         $sessionInfo['isStarted'] = true;
         $sessionInfo['name'] = $this->session->getName();
         $sessionInfo['identifier'] = $this->session->getId();
         $sessionInfo['csrfToken'] = $this->csrfTokenManager->getToken($this->csrfTokenIntention)->getValue();
         $sessionInfo['href'] = $this->generateUrl('ezpublish_rest_deleteSession', ['sessionId' => $this->session->getId()]);
     }
     return $sessionInfo;
 }
开发者ID:yed30,项目名称:PlatformUIBundle,代码行数:12,代码来源:SessionInfo.php

示例9: onSiteAccessMatch

 public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
 {
     if (!$this->session || $event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
         return;
     }
     $sessionName = $this->session->getName();
     $request = $event->getRequest();
     if (!$this->session->isStarted() && !$request->hasPreviousSession() && $request->request->has($sessionName)) {
         $this->session->setId($request->request->get($sessionName));
         $this->session->start();
     }
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:12,代码来源:SessionInitByPostListener.php

示例10: onKernelRequest

 public function onKernelRequest(GetResponseEvent $event)
 {
     if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
         return;
     }
     $request = $event->getRequest();
     if ($request->request->has('sessionId')) {
         $request->cookies->set($this->session->getName(), 1);
         $sessionId = $this->encryption->decrypt($request->request->get('sessionId'));
         $this->session->setId($sessionId);
     }
 }
开发者ID:csbill,项目名称:csbill,代码行数:12,代码来源:SessionRequestListener.php

示例11: setToken

 /**
  * @param TokenInterface $token
  */
 private function setToken(TokenInterface $token)
 {
     $serializedToken = serialize($token);
     $this->session->set($this->sessionTokenVariable, $serializedToken);
     $this->session->save();
     $this->cookieSetter->setCookie($this->session->getName(), $this->session->getId());
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:SecurityService.php

示例12: onBuildKernelHandler

 /**
  * Adds the session settings to the parameters that will be injected
  * into the legacy kernel
  *
  * @param \eZ\Publish\Core\MVC\Legacy\Event\PreBuildKernelEvent $event
  */
 public function onBuildKernelHandler(PreBuildKernelEvent $event)
 {
     $sessionInfos = array('configured' => false, 'started' => false, 'name' => false, 'namespace' => false, 'has_previous' => false, 'storage' => false);
     if (isset($this->session)) {
         $sessionInfos['configured'] = true;
         $sessionInfos['name'] = $this->session->getName();
         $sessionInfos['started'] = $this->session->isStarted();
         $sessionInfos['namespace'] = $this->sessionStorageKey;
         $sessionInfos['has_previous'] = isset($this->request) ? $this->request->hasPreviousSession() : false;
         $sessionInfos['storage'] = $this->sessionStorage;
     }
     $legacyKernelParameters = $event->getParameters();
     $legacyKernelParameters->set('session', $sessionInfos);
     // Deactivate session cookie settings in legacy kernel.
     // This will force using settings defined in Symfony.
     $sessionSettings = array('site.ini/Session/CookieTimeout' => false, 'site.ini/Session/CookiePath' => false, 'site.ini/Session/CookieDomain' => false, 'site.ini/Session/CookieSecure' => false, 'site.ini/Session/CookieHttponly' => false);
     $legacyKernelParameters->set("injected-settings", $sessionSettings + (array) $legacyKernelParameters->get("injected-settings"));
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:24,代码来源:Session.php

示例13: makeCookie

 protected function makeCookie(Request $request)
 {
     // merge native PHP session cookie params with custom ones.
     $params = array_replace(session_get_cookie_params(), $this->cookies);
     // if the cookie lifetime is not 0 (closes when browser window closes),
     // add the request time and the lifetime to get the expiration time of
     // the cookie.
     if ($params['lifetime'] !== 0) {
         $params['lifetime'] = $request->server->get('REQUEST_TIME') + $params['lifetime'];
     }
     return new Cookie($this->session->getName(), $this->session->getId(), $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']);
 }
开发者ID:autarky,项目名称:framework,代码行数:12,代码来源:SessionMiddleware.php

示例14:

 function it_logs_user_in(UserRepositoryInterface $userRepository, SessionInterface $session, CookieSetterInterface $cookieSetter, UserInterface $user)
 {
     $userRepository->findOneBy(['username' => 'sylius@example.com'])->willReturn($user);
     $user->getRoles()->willReturn(['ROLE_USER']);
     $user->getPassword()->willReturn('xyz');
     $user->serialize()->willReturn('serialized_user');
     $session->set('_security_context_name', Argument::any())->shouldBeCalled();
     $session->save()->shouldBeCalled();
     $session->getName()->willReturn('MOCKEDSID');
     $session->getId()->willReturn('xyzc123');
     $cookieSetter->setCookie('MOCKEDSID', 'xyzc123')->shouldBeCalled();
     $this->logIn('sylius@example.com');
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:13,代码来源:SecurityServiceSpec.php

示例15: login

 /**
  * @param BaseUser $user
  * @param SessionInterface $session
  * @param $firewall
  * @throws UnsupportedDriverActionException
  */
 public function login(BaseUser $user, SessionInterface $session, $firewall)
 {
     $driver = $this->getDriver();
     if (!$driver instanceof BrowserKitDriver) {
         //Fall back to manual login if BrowserKitDriver is not used
         throw new UnsupportedDriverActionException("Not supported by the current driver", $driver);
     }
     $client = $driver->getClient();
     $client->getCookieJar()->set(new Cookie(session_name(), true));
     $token = new UsernamePasswordToken($user, null, $firewall, $user->getRoles());
     $session->set('_security_' . $firewall, serialize($token));
     $session->save();
     $cookie = new Cookie($session->getName(), $session->getId());
     $client->getCookieJar()->set($cookie);
 }
开发者ID:vivait,项目名称:user-bundle,代码行数:21,代码来源:Login.php


注:本文中的Symfony\Component\HttpFoundation\Session\SessionInterface::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。