本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::migrate方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::migrate方法的具体用法?PHP SessionInterface::migrate怎么用?PHP SessionInterface::migrate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::migrate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: revokeSession
/**
* Log out the currently logged in user.
*
* @return boolean
*/
public function revokeSession()
{
$this->flashLogger->info(Trans::__('You have been logged out.'));
// Remove all auth tokens when logging off a user
if ($sessionAuth = $this->session->get('authentication')) {
$this->repositoryAuthtoken->deleteTokens($sessionAuth->getUser()->getUsername());
}
$this->session->remove('authentication');
$this->session->migrate(true);
return false;
}
示例2: revokeSession
/**
* Log out the currently logged in user.
*
* @return boolean
*/
public function revokeSession()
{
try {
// Only show this flash if there are users in the system.
// Not when we're about to get redirected to the "first users" screen.
if ($this->repositoryUsers->hasUsers()) {
$this->flashLogger->info(Trans::__('You have been logged out.'));
}
} catch (TableNotFoundException $e) {
// If we have no table, then we definitely have no users
}
// Remove all auth tokens when logging off a user
if ($sessionAuth = $this->session->get('authentication')) {
$this->repositoryAuthtoken->deleteTokens($sessionAuth->getUser()->getUsername());
}
$this->session->remove('authentication');
$this->session->migrate(true);
return false;
}
示例3: testMigrateDestroy
public function testMigrateDestroy()
{
$this->session->set('migrate', 333);
$this->session->migrate(true);
$this->assertEquals(333, $this->session->get('migrate'));
}
示例4: updateSession
/**
* Update the session with the given ID.
*
* @param string $id
* @return void
*/
protected function updateSession($id)
{
$this->session->set($this->getName(), $id);
$this->session->migrate(true);
}
示例5: login
/**
* Log an user into the application.
*
* @param UserInterface $user
* @return Response
*/
public function login(UserInterface $user)
{
$this->session->migrate();
$this->setUser($user);
return $this->events->dispatch(AuthEvents::LOGIN, new LoginEvent($user))->getResponse();
}
示例6: migrate
/**
* Migrates the session to a new session id while maintaining session attributes
*
* @param boolean $destroy Whether to delete the session or let gc handle clean up
* @return boolean
* @since 1.9
*/
public function migrate($destroy = false)
{
return $this->storage->migrate($destroy);
}
示例7: migrate
/**
* Migrates the current session to a new session id while maintaining all
* session attributes.
*/
public function migrate()
{
$this->session->migrate();
}
示例8: logIn
/**
* @param SessionInterface $session
* @param int $userId
*/
public function logIn(SessionInterface $session, $userId)
{
$session->migrate();
$session->set('user_id', $userId);
}
示例9: migrate
/**
* Migrate session
*
* @param bool $destroy
* @param null $lifetime
*/
public function migrate($destroy = false, $lifetime = null)
{
$this->session->migrate($destroy, $lifetime);
}
示例10: handleLogin
/**
* @param SessionInterface $session
* @param AuthenticationDataVO $authenticationVo
* @param UserVO $userVo
* @return AuthenticateUserEvent
*/
private function handleLogin(SessionInterface $session, AuthenticationDataVO $authenticationVo, UserVO $userVo)
{
$event = new AuthenticateUserEvent($authenticationVo, AuthenticateUserEvent::CHECK);
$this->dispatchEvent($event);
$session->set('user_id', $userVo->id);
// renew session-id to prevent session fixation
$session->migrate();
$event = new AuthenticateUserEvent($authenticationVo, AuthenticateUserEvent::AUTHENTICATED);
$this->dispatchEvent($event);
}
示例11: logIn
/**
* @param SessionInterface $session
* @param int $userId
*/
public function logIn(SessionInterface $session, $userId)
{
$session->migrate();
$session->set('user_id', $userId);
$session->set('sudo_expiry', new DateTime('+30 minutes'));
}