processLogout($request); $redirectUrl = $request->getParsedBody()['redirect'] ?? $request->getQueryParams()['redirect'] ?? ''; $redirectUrl = GeneralUtility::sanitizeLocalUrl($redirectUrl, $request); if (empty($redirectUrl)) { $redirectUrl = (string)$this->uriBuilder->buildUriFromRoute('login', [], UriBuilder::ABSOLUTE_URL); } return new RedirectResponse(GeneralUtility::locationHeaderUrl($redirectUrl, $request), 303); } /** * Performs the logout processing */ protected function processLogout(ServerRequestInterface $request): void { if (empty($this->getBackendUser()->user['username'])) { return; } // Logout written to log $this->getBackendUser()->writelog(SystemLogType::LOGIN, SystemLogLoginAction::LOGOUT, SystemLogErrorClassification::MESSAGE, null, 'User %s logged out from TYPO3 Backend', [$this->getBackendUser()->user['username']]); /** @var BackendFormProtection $backendFormProtection */ $backendFormProtection = $this->formProtectionFactory->createFromRequest($request); $backendFormProtection->removeSessionTokenFromRegistry(); $this->getBackendUser()->logoff(); } protected function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } }