[BUGFIX] Allow direct access to BE again while being logged in
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / LoginController.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Backend\Controller;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
20 use Psr\Log\LoggerAwareInterface;
21 use Psr\Log\LoggerAwareTrait;
22 use TYPO3\CMS\Backend\Exception;
23 use TYPO3\CMS\Backend\LoginProvider\LoginProviderInterface;
24 use TYPO3\CMS\Backend\Routing\UriBuilder;
25 use TYPO3\CMS\Backend\Template\DocumentTemplate;
26 use TYPO3\CMS\Backend\Utility\BackendUtility;
27 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
28 use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
29 use TYPO3\CMS\Core\Database\ConnectionPool;
30 use TYPO3\CMS\Core\FormProtection\BackendFormProtection;
31 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
32 use TYPO3\CMS\Core\Http\HtmlResponse;
33 use TYPO3\CMS\Core\Localization\LanguageService;
34 use TYPO3\CMS\Core\Localization\Locales;
35 use TYPO3\CMS\Core\Page\PageRenderer;
36 use TYPO3\CMS\Core\Utility\GeneralUtility;
37 use TYPO3\CMS\Core\Utility\HttpUtility;
38 use TYPO3\CMS\Core\Utility\PathUtility;
39 use TYPO3\CMS\Fluid\View\StandaloneView;
40
41 /**
42 * Script Class for rendering the login form
43 */
44 class LoginController implements LoggerAwareInterface
45 {
46 use LoggerAwareTrait;
47
48 /**
49 * The URL to redirect to after login.
50 *
51 * @var string
52 */
53 protected $redirectUrl;
54
55 /**
56 * Set to the redirect URL of the form (may be redirect_url or "index.php?M=main")
57 *
58 * @var string
59 */
60 protected $redirectToURL;
61
62 /**
63 * the active login provider identifier
64 *
65 * @var string
66 */
67 protected $loginProviderIdentifier = null;
68
69 /**
70 * List of registered and sorted login providers
71 *
72 * @var array
73 */
74 protected $loginProviders = [];
75
76 /**
77 * Login-refresh bool; The backend will call this script
78 * with this value set when the login is close to being expired
79 * and the form needs to be redrawn.
80 *
81 * @var bool
82 */
83 protected $loginRefresh;
84
85 /**
86 * Value of forms submit button for login.
87 *
88 * @var string
89 */
90 protected $submitValue;
91
92 /**
93 * @var StandaloneView
94 */
95 protected $view;
96
97 /**
98 * Initialize the login box. Will also react on a &L=OUT flag and exit.
99 */
100 public function __construct()
101 {
102 // @deprecated since v9, will be obsolete in v10
103 $request = $GLOBALS['TYPO3_REQUEST'];
104 $parsedBody = $request->getParsedBody();
105 $queryParams = $request->getQueryParams();
106 $this->validateAndSortLoginProviders();
107
108 // We need a PHP session session for most login levels
109 session_start();
110 $this->redirectUrl = GeneralUtility::sanitizeLocalUrl($parsedBody['redirect_url'] ?? $queryParams['redirect_url'] ?? null);
111 $this->loginProviderIdentifier = $this->detectLoginProvider($request);
112
113 $this->loginRefresh = (bool)($parsedBody['loginRefresh'] ?? $queryParams['loginRefresh'] ?? false);
114 // Value of "Login" button. If set, the login button was pressed.
115 $this->submitValue = $parsedBody['commandLI'] ?? $queryParams['commandLI'] ?? null;
116 // Try to get the preferred browser language
117 /** @var Locales $locales */
118 $locales = GeneralUtility::makeInstance(Locales::class);
119 $httpAcceptLanguage = $request->getServerParams()['HTTP_ACCEPT_LANGUAGE'];
120 $preferredBrowserLanguage = $locales
121 ->getPreferredClientLanguage($httpAcceptLanguage);
122
123 // If we found a $preferredBrowserLanguage and it is not the default language and no be_user is logged in
124 // initialize $this->getLanguageService() again with $preferredBrowserLanguage
125 if ($preferredBrowserLanguage !== 'default' && empty($this->getBackendUserAuthentication()->user['uid'])) {
126 $this->getLanguageService()->init($preferredBrowserLanguage);
127 GeneralUtility::makeInstance(PageRenderer::class)->setLanguage($preferredBrowserLanguage);
128 }
129
130 $this->getLanguageService()->includeLLFile('EXT:backend/Resources/Private/Language/locallang_login.xlf');
131
132 // Setting the redirect URL to "index.php?M=main" if no alternative input is given
133 if ($this->redirectUrl) {
134 $this->redirectToURL = $this->redirectUrl;
135 } else {
136 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
137 $this->redirectToURL = (string)$uriBuilder->buildUriFromRoute('main');
138 }
139
140 // If "L" is "OUT", then any logged in is logged out. If redirect_url is given, we redirect to it
141 if (($parsedBody['L'] ?? $queryParams['L'] ?? null) === 'OUT' && is_object($this->getBackendUserAuthentication())) {
142 $this->getBackendUserAuthentication()->logoff();
143 $this->redirectToUrl();
144 }
145
146 $this->view = $this->getFluidTemplateObject();
147 }
148
149 /**
150 * Injects the request and response objects for the current request or subrequest
151 * As this controller goes only through the main() method, it is rather simple for now
152 *
153 * @param ServerRequestInterface $request the current request
154 * @return ResponseInterface the finished response with the content
155 */
156 public function formAction(ServerRequestInterface $request): ResponseInterface
157 {
158 return new HtmlResponse($this->createLoginLogoutForm($request));
159 }
160
161 /**
162 * Calls the main function but with loginRefresh enabled at any time
163 *
164 * @param ServerRequestInterface $request the current request
165 * @return ResponseInterface the finished response with the content
166 */
167 public function refreshAction(ServerRequestInterface $request): ResponseInterface
168 {
169 $this->loginRefresh = true;
170 return new HtmlResponse($this->createLoginLogoutForm($request));
171 }
172
173 /**
174 * Main function - creating the login/logout form
175 *
176 * @throws Exception
177 * @return string The content to output
178 * @deprecated since v9, will be removed in v10
179 */
180 public function main(): string
181 {
182 trigger_error('Method main() will be replaced by protected method createLoginLogoutForm() in v10. Do not call from other extension', E_USER_DEPRECATED);
183 return $this->createLoginLogoutForm($GLOBALS['TYPO3_REQUEST']);
184 }
185
186 /**
187 * Main function - creating the login/logout form
188 *
189 * @param ServerRequestInterface $request
190 * @return string $content
191 * @throws Exception
192 */
193 protected function createLoginLogoutForm(ServerRequestInterface $request): string
194 {
195 /** @var $pageRenderer PageRenderer */
196 $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
197 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Login');
198
199 // Checking, if we should make a redirect.
200 // Might set JavaScript in the header to close window.
201 $this->checkRedirect($request);
202
203 // Extension Configuration
204 $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('backend');
205
206 // Background Image
207 if (!empty($extConf['loginBackgroundImage'])) {
208 $backgroundImage = $this->getUriForFileName($extConf['loginBackgroundImage']);
209 if ($backgroundImage === '') {
210 $this->logger->warning(
211 'The configured TYPO3 backend login background image "' . htmlspecialchars($extConf['loginBackgroundImage']) .
212 '" can\'t be resolved. Please check if the file exists and the extension is activated.'
213 );
214 }
215 $this->getDocumentTemplate()->inDocStylesArray[] = '
216 .typo3-login-carousel-control.right,
217 .typo3-login-carousel-control.left,
218 .panel-login { border: 0; }
219 .typo3-login { background-image: url("' . $backgroundImage . '"); }
220 .typo3-login-footnote { background-color: #000000; color: #ffffff; opacity: 0.5; }
221 ';
222 }
223
224 // Login Footnote
225 if (!empty($extConf['loginFootnote'])) {
226 $this->view->assign('loginFootnote', strip_tags(trim($extConf['loginFootnote'])));
227 }
228
229 // Add additional css to use the highlight color in the login screen
230 if (!empty($extConf['loginHighlightColor'])) {
231 $this->getDocumentTemplate()->inDocStylesArray[] = '
232 .btn-login.disabled, .btn-login[disabled], fieldset[disabled] .btn-login,
233 .btn-login.disabled:hover, .btn-login[disabled]:hover, fieldset[disabled] .btn-login:hover,
234 .btn-login.disabled:focus, .btn-login[disabled]:focus, fieldset[disabled] .btn-login:focus,
235 .btn-login.disabled.focus, .btn-login[disabled].focus, fieldset[disabled] .btn-login.focus,
236 .btn-login.disabled:active, .btn-login[disabled]:active, fieldset[disabled] .btn-login:active,
237 .btn-login.disabled.active, .btn-login[disabled].active, fieldset[disabled] .btn-login.active,
238 .btn-login:hover, .btn-login:focus, .btn-login:active,
239 .btn-login:active:hover, .btn-login:active:focus,
240 .btn-login { background-color: ' . $extConf['loginHighlightColor'] . '; }
241 .panel-login .panel-body { border-color: ' . $extConf['loginHighlightColor'] . '; }
242 ';
243 }
244
245 // Logo
246 if (!empty($extConf['loginLogo'])) {
247 if ($this->getUriForFileName($extConf['loginLogo']) === '') {
248 $this->logger->warning(
249 'The configured TYPO3 backend login logo "' . htmlspecialchars($extConf['loginLogo']) .
250 '" can\'t be resolved. Please check if the file exists and the extension is activated.'
251 );
252 }
253 $logo = $extConf['loginLogo'];
254 } else {
255 // Use TYPO3 logo depending on highlight color
256 if (!empty($extConf['loginHighlightColor'])) {
257 $logo = 'EXT:backend/Resources/Public/Images/typo3_black.svg';
258 } else {
259 $logo = 'EXT:backend/Resources/Public/Images/typo3_orange.svg';
260 }
261 $this->getDocumentTemplate()->inDocStylesArray[] = '
262 .typo3-login-logo .typo3-login-image { max-width: 150px; }
263 ';
264 }
265 $logo = $this->getUriForFileName($logo);
266
267 // Start form
268 $formType = empty($this->getBackendUserAuthentication()->user['uid']) ? 'LoginForm' : 'LogoutForm';
269 $this->view->assignMultiple([
270 'backendUser' => $this->getBackendUserAuthentication()->user,
271 'hasLoginError' => $this->isLoginInProgress($request),
272 'formType' => $formType,
273 'logo' => $logo,
274 'images' => [
275 'capslock' => $this->getUriForFileName('EXT:backend/Resources/Public/Images/icon_capslock.svg'),
276 'typo3' => $this->getUriForFileName('EXT:backend/Resources/Public/Images/typo3_orange.svg'),
277 ],
278 'copyright' => BackendUtility::TYPO3_copyRightNotice(),
279 'redirectUrl' => $this->redirectUrl,
280 'loginRefresh' => $this->loginRefresh,
281 'loginNewsItems' => $this->getSystemNews(),
282 'loginProviderIdentifier' => $this->loginProviderIdentifier,
283 'loginProviders' => $this->loginProviders
284 ]);
285
286 // Initialize interface selectors:
287 $this->makeInterfaceSelector($request);
288
289 /** @var LoginProviderInterface $loginProvider */
290 $loginProvider = GeneralUtility::makeInstance($this->loginProviders[$this->loginProviderIdentifier]['provider']);
291 $loginProvider->render($this->view, $pageRenderer, $this);
292
293 $content = $this->getDocumentTemplate()->startPage('TYPO3 CMS Login: ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
294 $content .= $this->view->render();
295 $content .= $this->getDocumentTemplate()->endPage();
296
297 return $content;
298 }
299
300 /**
301 * Checking, if we should perform some sort of redirection OR closing of windows.
302 *
303 * Do a redirect if a user is logged in
304 *
305 * @param ServerRequestInterface $request
306 * @throws \RuntimeException
307 * @throws \UnexpectedValueException
308 * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
309 */
310 protected function checkRedirect(ServerRequestInterface $request): void
311 {
312 if (empty($this->getBackendUserAuthentication()->user['uid'])) {
313 return;
314 }
315
316 /*
317 * If no cookie has been set previously, we tell people that this is a problem.
318 * This assumes that a cookie-setting script (like this one) has been hit at
319 * least once prior to this instance.
320 */
321 if (!isset($_COOKIE[BackendUserAuthentication::getCookieName()])) {
322 if ($this->submitValue === 'setCookie') {
323 /*
324 * we tried it a second time but still no cookie
325 * 26/4 2005: This does not work anymore, because the saving of challenge values
326 * in $_SESSION means the system will act as if the password was wrong.
327 */
328 throw new \RuntimeException('Login-error: Yeah, that\'s a classic. No cookies, no TYPO3. ' .
329 'Please accept cookies from TYPO3 - otherwise you\'ll not be able to use the system.', 1294586846);
330 }
331 // try it once again - that might be needed for auto login
332 $this->redirectToURL = 'index.php?commandLI=setCookie';
333 }
334 $redirectToUrl = (string)$this->getBackendUserAuthentication()->getTSConfigVal('auth.BE.redirectToURL');
335 if (empty($redirectToUrl)) {
336 // Based on the interface we set the redirect script
337 $parsedBody = $request->getParsedBody();
338 $queryParams = $request->getQueryParams();
339 $interface = $parsedBody['interface'] ?? $queryParams['interface'] ?? '';
340 switch ($interface) {
341 case 'frontend':
342 $this->redirectToURL = '../';
343 break;
344 case 'backend':
345 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
346 $this->redirectToURL = (string)$uriBuilder->buildUriFromRoute('main');
347 break;
348 }
349 } else {
350 $this->redirectToURL = $redirectToUrl;
351 $interface = '';
352 }
353 // store interface
354 $this->getBackendUserAuthentication()->uc['interfaceSetup'] = $interface;
355 $this->getBackendUserAuthentication()->writeUC();
356
357 $formProtection = FormProtectionFactory::get();
358 if (!$formProtection instanceof BackendFormProtection) {
359 throw new \RuntimeException('The Form Protection retrieved does not match the expected one.', 1432080411);
360 }
361 if ($this->loginRefresh) {
362 $formProtection->setSessionTokenFromRegistry();
363 $formProtection->persistSessionToken();
364 $this->getDocumentTemplate()->JScode .= GeneralUtility::wrapJS('
365 if (window.opener && window.opener.TYPO3 && window.opener.TYPO3.LoginRefresh) {
366 window.opener.TYPO3.LoginRefresh.startTask();
367 window.close();
368 }
369 ');
370 } else {
371 $formProtection->storeSessionTokenInRegistry();
372 $this->redirectToUrl();
373 }
374 }
375
376 /**
377 * Making interface selector
378 *
379 * @deprecated since v9, will be removed in v10
380 */
381 public function makeInterfaceSelectorBox(): void
382 {
383 trigger_error('Method makeInterfaceSelectorBox() will be replaced by protected method makeInterfaceSelector() in v10. Do not call from other extension', E_USER_DEPRECATED);
384 $this->makeInterfaceSelector($GLOBALS['TYPO3_REQUEST']);
385 }
386
387 /**
388 * Making interface selector
389 * @param ServerRequestInterface $request
390 */
391 protected function makeInterfaceSelector(ServerRequestInterface $request): void
392 {
393 // If interfaces are defined AND no input redirect URL in GET vars:
394 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] && ($this->isLoginInProgress($request) || !$this->redirectUrl)) {
395 $parts = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']);
396 if (count($parts) > 1) {
397 // Only if more than one interface is defined we will show the selector
398 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
399 $interfaces = [
400 'backend' => [
401 'label' => $this->getLanguageService()->getLL('interface.backend'),
402 'jumpScript' => (string)$uriBuilder->buildUriFromRoute('main'),
403 'interface' => 'backend'
404 ],
405 'frontend' => [
406 'label' => $this->getLanguageService()->getLL('interface.frontend'),
407 'jumpScript' => '../',
408 'interface' => 'frontend'
409 ]
410 ];
411
412 $this->view->assign('showInterfaceSelector', true);
413 $this->view->assign('interfaces', $interfaces);
414 } elseif (!$this->redirectUrl) {
415 // If there is only ONE interface value set and no redirect_url is present
416 $this->view->assign('showInterfaceSelector', false);
417 $this->view->assign('interface', $parts[0]);
418 }
419 }
420 }
421
422 /**
423 * Gets news from sys_news and converts them into a format suitable for
424 * showing them at the login screen.
425 *
426 * @return array An array of login news.
427 */
428 protected function getSystemNews(): array
429 {
430 $systemNewsTable = 'sys_news';
431 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
432 ->getQueryBuilderForTable($systemNewsTable);
433 $systemNews = [];
434 $systemNewsRecords = $queryBuilder
435 ->select('title', 'content', 'crdate')
436 ->from($systemNewsTable)
437 ->orderBy('crdate', 'DESC')
438 ->execute()
439 ->fetchAll();
440 foreach ($systemNewsRecords as $systemNewsRecord) {
441 $systemNews[] = [
442 'date' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], (int)$systemNewsRecord['crdate']),
443 'header' => $systemNewsRecord['title'],
444 'content' => $systemNewsRecord['content']
445 ];
446 }
447 return $systemNews;
448 }
449
450 /**
451 * Returns the uri of a relative reference, resolves the "EXT:" prefix
452 * (way of referring to files inside extensions) and checks that the file is inside
453 * the PATH_site of the TYPO3 installation
454 *
455 * @param string $filename The input filename/filepath to evaluate
456 * @return string Returns the filename of $filename if valid, otherwise blank string.
457 * @internal
458 */
459 private function getUriForFileName($filename): string
460 {
461 // Check if it's already a URL
462 if (preg_match('/^(https?:)?\/\//', $filename)) {
463 return $filename;
464 }
465 $absoluteFilename = GeneralUtility::getFileAbsFileName(ltrim($filename, '/'));
466 $filename = '';
467 if ($absoluteFilename !== '' && @is_file($absoluteFilename)) {
468 $filename = PathUtility::getAbsoluteWebPath($absoluteFilename);
469 }
470 return $filename;
471 }
472
473 /**
474 * Checks if login credentials are currently submitted
475 *
476 * @param ServerRequestInterface $request
477 * @return bool
478 */
479 protected function isLoginInProgress(ServerRequestInterface $request): bool
480 {
481 $parsedBody = $request->getParsedBody();
482 $queryParams = $request->getQueryParams();
483 $username = $parsedBody['username'] ?? $queryParams['username'] ?? null;
484 return !empty($username) || !empty($this->submitValue);
485 }
486
487 /**
488 * returns a new standalone view, shorthand function
489 *
490 * @return StandaloneView
491 */
492 protected function getFluidTemplateObject()
493 {
494 /** @var StandaloneView $view */
495 $view = GeneralUtility::makeInstance(StandaloneView::class);
496 $view->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Layouts')]);
497 $view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials')]);
498 $view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates')]);
499
500 $view->getRequest()->setControllerExtensionName('Backend');
501 return $view;
502 }
503
504 /**
505 * Wrapper method to redirect to configured redirect URL
506 */
507 protected function redirectToUrl(): void
508 {
509 HttpUtility::redirect($this->redirectToURL);
510 }
511
512 /**
513 * Validates the registered login providers
514 *
515 * @throws \RuntimeException
516 */
517 protected function validateAndSortLoginProviders()
518 {
519 $providers = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] ?? [];
520 if (empty($providers) || !is_array($providers)) {
521 throw new \RuntimeException('No login providers are registered in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'backend\'][\'loginProviders\'].', 1433417281);
522 }
523 foreach ($providers as $identifier => $configuration) {
524 if (empty($configuration) || !is_array($configuration)) {
525 throw new \RuntimeException('Missing configuration for login provider "' . $identifier . '".', 1433416043);
526 }
527 if (!is_string($configuration['provider']) || empty($configuration['provider']) || !class_exists($configuration['provider']) || !is_subclass_of($configuration['provider'], LoginProviderInterface::class)) {
528 throw new \RuntimeException('The login provider "' . $identifier . '" defines an invalid provider. Ensure the class exists and implements the "' . LoginProviderInterface::class . '".', 1460977275);
529 }
530 if (empty($configuration['label'])) {
531 throw new \RuntimeException('Missing label definition for login provider "' . $identifier . '".', 1433416044);
532 }
533 if (empty($configuration['icon-class'])) {
534 throw new \RuntimeException('Missing icon definition for login provider "' . $identifier . '".', 1433416045);
535 }
536 if (!isset($configuration['sorting'])) {
537 throw new \RuntimeException('Missing sorting definition for login provider "' . $identifier . '".', 1433416046);
538 }
539 }
540 // sort providers
541 uasort($providers, function ($a, $b) {
542 return $b['sorting'] - $a['sorting'];
543 });
544 $this->loginProviders = $providers;
545 }
546
547 /**
548 * Detect the login provider, get from request or choose the
549 * first one as default
550 *
551 * @param ServerRequestInterface $request
552 * @return string
553 */
554 protected function detectLoginProvider(ServerRequestInterface $request): string
555 {
556 $parsedBody = $request->getParsedBody();
557 $queryParams = $request->getQueryParams();
558 $loginProvider = $parsedBody['loginProvider'] ?? $queryParams['loginProvider'] ?? '';
559 if ((empty($loginProvider) || !isset($this->loginProviders[$loginProvider])) && !empty($_COOKIE['be_lastLoginProvider'])) {
560 $loginProvider = $_COOKIE['be_lastLoginProvider'];
561 }
562 if (empty($loginProvider) || !isset($this->loginProviders[$loginProvider])) {
563 reset($this->loginProviders);
564 $loginProvider = key($this->loginProviders);
565 }
566 // Use the secure option when the current request is served by a secure connection:
567 $normalizedParams = $request->getAttribute('normalizedParams');
568 $isHttps = $normalizedParams->isHttps();
569 $cookieSecure = (bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['cookieSecure'] && $isHttps;
570 setcookie('be_lastLoginProvider', (string)$loginProvider, $GLOBALS['EXEC_TIME'] + 7776000, '', '', $cookieSecure, true); // 90 days
571 return (string)$loginProvider;
572 }
573
574 /**
575 * @return string
576 */
577 public function getLoginProviderIdentifier()
578 {
579 return $this->loginProviderIdentifier;
580 }
581
582 /**
583 * Returns LanguageService
584 *
585 * @return LanguageService
586 */
587 protected function getLanguageService(): LanguageService
588 {
589 return $GLOBALS['LANG'];
590 }
591
592 /**
593 * @return BackendUserAuthentication
594 */
595 protected function getBackendUserAuthentication(): BackendUserAuthentication
596 {
597 return $GLOBALS['BE_USER'];
598 }
599
600 /**
601 * Returns an instance of DocumentTemplate
602 *
603 * @return DocumentTemplate
604 */
605 protected function getDocumentTemplate(): DocumentTemplate
606 {
607 return $GLOBALS['TBE_TEMPLATE'];
608 }
609 }