/** * Logout all active authentication tokens * * @return void */ public function logout() { if ($this->isAuthenticated() !== true) { return; } $this->isAuthenticated = null; /** @var $token TokenInterface */ foreach ($this->securityContext->getAuthenticationTokens() as $token) { $token->setAuthenticationStatus(TokenInterface::NO_CREDENTIALS_GIVEN); } $this->emitLoggedOut(); if ($this->session->isStarted()) { $this->session->destroy('Logout through AuthenticationProviderManager'); } $this->securityContext->refreshTokens(); }