2 declare(strict_types = 1);
19 use Psr\Http\Message\ResponseInterface;
20 use Psr\Http\Message\ServerRequestInterface;
21 use Psr\Http\Server\MiddlewareInterface;
22 use Psr\Http\Server\RequestHandlerInterface;
53 public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
56 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'preBeUser'])) {
57 trigger_error(
'The "preBeUser" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
58 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'preBeUser'] as $_funcRef) {
60 GeneralUtility::callUserFunction($_funcRef, $_params,
$GLOBALS[
'TSFE']);
67 $backendUserObject =
null;
72 $GLOBALS[
'BE_USER'] = $backendUserObject;
75 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'])) {
79 trigger_error(
'The "postBeUser" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
80 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'] as $_funcRef) {
81 GeneralUtility::callUserFunction($_funcRef, $_params,
$GLOBALS[
'TSFE']);
95 return $handler->handle($request);
108 $backendUserObject = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class);
109 $backendUserObject->start();
110 $backendUserObject->unpack_uc();
111 if (!empty($backendUserObject->user[
'uid'])) {
112 $backendUserObject->fetchGroupData();
115 if (!$this->
isAuthenticated($backendUserObject, $request->getAttribute(
'normalizedParams'))) {
116 $backendUserObject =
null;
118 return $backendUserObject;
131 $ipMask = trim(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'IPmaskList'] ??
'');
132 if ($ipMask && !GeneralUtility::cmpIP($normalizedParams->
getRemoteAddress(), $ipMask)) {
136 if ((
bool)
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'lockSSL'] && !$normalizedParams->
isHttps()) {
150 $context->
setAspect(
'backend.user', GeneralUtility::makeInstance(UserAspect::class, $user));
151 $context->
setAspect(
'workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $user->workspace));