getId() public method

Returns the current session ID.
public getId ( ) : string
return string The current session ID
 /**
  * Redirects to the Neos backend on the given site, passing a one-time login token
  *
  * @param Site $site
  * @return void
  */
 public function switchSiteAction($site)
 {
     $token = Algorithms::generateRandomToken(32);
     $this->loginTokenCache->set($token, $this->currentSession->getId());
     $siteUri = $this->linkingService->createSiteUri($this->controllerContext, $site);
     $loginUri = $this->controllerContext->getUriBuilder()->reset()->uriFor('tokenLogin', ['token' => $token], 'Login', 'Neos.Neos');
     $this->redirectToUri($siteUri . $loginUri);
 }
 /**
  * Returns the specified session. If no session with the given identifier exists,
  * NULL is returned.
  *
  * @param string $sessionIdentifier The session identifier
  * @return SessionInterface
  * @api
  */
 public function getSession($sessionIdentifier)
 {
     if ($this->currentSession !== null && $this->currentSession->isStarted() && $this->currentSession->getId() === $sessionIdentifier) {
         return $this->currentSession;
     }
     if (isset($this->remoteSessions[$sessionIdentifier])) {
         return $this->remoteSessions[$sessionIdentifier];
     }
     if ($this->metaDataCache->has($sessionIdentifier)) {
         $sessionInfo = $this->metaDataCache->get($sessionIdentifier);
         $this->remoteSessions[$sessionIdentifier] = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
         return $this->remoteSessions[$sessionIdentifier];
     }
 }
 /**
  * @Flow\Session(autoStart = true)
  * @return string
  */
 public function sessionStartAction()
 {
     return 'this action started session ' . $this->session->getId();
 }