Returns the specified session. If no session with the given identifier exists,
NULL is returned.
public getSession ( string $sessionIdentifier ) : Neos\Flow\Session\SessionInterface | ||
$sessionIdentifier | string | The session identifier |
return | Neos\Flow\Session\SessionInterface |
/** * Logs a user in if a session identifier is available under the given token in the token cache. * * @param string $token * @return void */ public function tokenLoginAction($token) { $newSessionId = $this->loginTokenCache->get($token); $this->loginTokenCache->remove($token); if ($newSessionId === false) { $this->systemLogger->log(sprintf('Token-based login failed, non-existing or expired token %s', $token), LOG_WARNING); $this->redirect('index'); } $this->systemLogger->log(sprintf('Token-based login succeeded, token %s', $token), LOG_DEBUG); $newSession = $this->sessionManager->getSession($newSessionId); if ($newSession->canBeResumed()) { $newSession->resume(); } if ($newSession->isStarted()) { $newSession->putData('lastVisitedNode', null); } else { $this->systemLogger->log(sprintf('Failed resuming or starting session %s which was referred to in the login token %s.', $newSessionId, $token), LOG_ERR); } $this->replaceSessionCookie($newSessionId); $this->redirect('index', 'Backend\\Backend'); }
/** * Convert a session identifier from $source to a Session object * * @param string $source * @param string $targetType * @param array $convertedChildProperties * @param PropertyMappingConfigurationInterface $configuration * @return object the target type * @throws InvalidTargetException * @throws \InvalidArgumentException */ public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { return $this->sessionManager->getSession($source); }