TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
BackendUserAuthenticator.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
namespace
TYPO3\CMS\Backend\Middleware
;
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\Http\Server\MiddlewareInterface;
21
use Psr\Http\Server\RequestHandlerInterface;
22
use
TYPO3\CMS\Core\Authentication\BackendUserAuthentication
;
23
use
TYPO3\CMS\Core\Context\Context
;
24
use
TYPO3\CMS\Core\Context\UserAspect
;
25
use
TYPO3\CMS\Core\Context\WorkspaceAspect
;
26
use
TYPO3\CMS\Core\Core\Bootstrap
;
27
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
28
34
class
BackendUserAuthenticator
implements
MiddlewareInterface
35
{
41
protected
$publicRoutes
= [
42
'/login'
,
43
'/login/frame'
,
44
'/ajax/login'
,
45
'/ajax/logout'
,
46
'/ajax/login/preflight'
,
47
'/ajax/login/refresh'
,
48
'/ajax/login/timedout'
,
49
'/ajax/rsa/publickey'
,
50
'/ajax/core/requirejs'
,
51
];
52
60
public
function
process
(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
61
{
62
$pathToRoute = $request->getAttribute(
'routePath'
,
'/login'
);
63
64
Bootstrap::initializeBackendUser
();
65
// @todo: once this logic is in this method, the redirect URL should be handled as response here
66
Bootstrap::initializeBackendAuthentication
($this->
isLoggedInBackendUserRequired
($pathToRoute));
67
Bootstrap::initializeLanguageObject
();
68
// Register the backend user as aspect
69
$this->
setBackendUserAspect
(GeneralUtility::makeInstance(Context::class),
$GLOBALS
[
'BE_USER'
]);
70
71
return
$handler->handle($request);
72
}
73
81
protected
function
isLoggedInBackendUserRequired
(
string
$routePath):
bool
82
{
83
return
in_array($routePath, $this->publicRoutes,
true
);
84
}
85
92
protected
function
setBackendUserAspect
(
Context
$context,
BackendUserAuthentication
$user)
93
{
94
$context->
setAspect
(
'backend.user'
, GeneralUtility::makeInstance(UserAspect::class, $user));
95
$context->
setAspect
(
'workspace'
, GeneralUtility::makeInstance(WorkspaceAspect::class, $user->workspace));
96
}
97
}
TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator\$publicRoutes
array $publicRoutes
Definition:
BackendUserAuthenticator.php:40
TYPO3\CMS\Core\Context\WorkspaceAspect
Definition:
WorkspaceAspect.php:29
TYPO3\CMS\Backend\Middleware
Definition:
AdditionalResponseHeaders.php:3
TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator\process
ResponseInterface process(ServerRequestInterface $request, RequestHandlerInterface $handler)
Definition:
BackendUserAuthenticator.php:59
TYPO3\CMS\Core\Context\Context
Definition:
Context.php:49
TYPO3\CMS\Core\Core\Bootstrap\initializeBackendUser
static Bootstrap null initializeBackendUser($className=\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class)
Definition:
Bootstrap.php:956
TYPO3\CMS\Core\Context\Context\setAspect
setAspect(string $name, AspectInterface $aspect)
Definition:
Context.php:141
TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator\setBackendUserAspect
setBackendUserAspect(Context $context, BackendUserAuthentication $user)
Definition:
BackendUserAuthenticator.php:91
TYPO3\CMS\Core\Core\Bootstrap\initializeBackendAuthentication
static Bootstrap null initializeBackendAuthentication($proceedIfNoUserIsLoggedIn=false)
Definition:
Bootstrap.php:974
TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator\isLoggedInBackendUserRequired
bool isLoggedInBackendUserRequired(string $routePath)
Definition:
BackendUserAuthenticator.php:80
TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition:
BackendUserAuthentication.php:45
$GLOBALS
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition:
ext_localconf.php:5
TYPO3\CMS\Core\Core\Bootstrap
Definition:
Bootstrap.php:50
TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator
Definition:
BackendUserAuthenticator.php:35
TYPO3\CMS\Core\Utility\GeneralUtility
Definition:
GeneralUtility.php:45
TYPO3\CMS\Core\Context\UserAspect
Definition:
UserAspect.php:36
TYPO3\CMS\Core\Core\Bootstrap\initializeLanguageObject
static Bootstrap null initializeLanguageObject()
Definition:
Bootstrap.php:986
doxygen
typo3
sysext
backend
Classes
Middleware
BackendUserAuthenticator.php
Generated on Tue Oct 5 2021 01:56:55 for TYPO3CMS by
1.8.18