‪TYPO3CMS  10.4
TYPO3\CMS\Core\Middleware\BackendUserAuthenticator Class Reference
Inheritance diagram for TYPO3\CMS\Core\Middleware\BackendUserAuthenticator:
TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator TYPO3\CMS\Frontend\Middleware\BackendUserAuthenticator

Public Member Functions

 __construct (Context $context)
 
 process (ServerRequestInterface $request, RequestHandlerInterface $handler)
 

Protected Member Functions

ResponseInterface applyHeadersToResponse (ResponseInterface $response)
 
 setBackendUserAspect (?BackendUserAuthentication $user, int $alternativeWorkspaceId=null)
 

Protected Attributes

Context $context
 

Detailed Description

Boilerplate to authenticate a backend user in the current workflow, can be used for TYPO3 Backend and Frontend requests.

The actual authentication and the selection if no-cache headers to responses should be applied should still reside in the "process()" method which should be extended by derivative classes.

In derivative classes, the Context API can be used to detect, if a backend user is logged in like this:

$response = $handler->handle($request); if ($this->context->getAspect('backend.user')->isLoggedIn()) { return $this->applyHeadersToResponse($response); }

this class might get merged again with the subclasses

Definition at line 48 of file BackendUserAuthenticator.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Middleware\BackendUserAuthenticator::__construct ( Context  $context)

Member Function Documentation

◆ applyHeadersToResponse()

ResponseInterface TYPO3\CMS\Core\Middleware\BackendUserAuthenticator::applyHeadersToResponse ( ResponseInterface  $response)
protected

Adding headers to the response to avoid caching on the client side. These headers will override any previous headers of these names sent. Get the http headers to be sent if an authenticated user is available, in order to disallow browsers to store the response on the client side.

Parameters
ResponseInterface$response
Returns
‪ResponseInterface the modified response object.

Definition at line 73 of file BackendUserAuthenticator.php.

Referenced by TYPO3\CMS\Frontend\Middleware\BackendUserAuthenticator\process(), and TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator\process().

◆ process()

TYPO3\CMS\Core\Middleware\BackendUserAuthenticator::process ( ServerRequestInterface  $request,
RequestHandlerInterface  $handler 
)
abstract

◆ setBackendUserAspect()

TYPO3\CMS\Core\Middleware\BackendUserAuthenticator::setBackendUserAspect ( ?BackendUserAuthentication  $user,
int  $alternativeWorkspaceId = null 
)
protected

Register the backend user as aspect

Parameters
BackendUserAuthentication | null$user
int | null$alternativeWorkspaceId

Definition at line 94 of file BackendUserAuthenticator.php.

Referenced by TYPO3\CMS\Frontend\Middleware\BackendUserAuthenticator\initializeBackendUser(), TYPO3\CMS\Frontend\Middleware\BackendUserAuthenticator\process(), and TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator\process().

Member Data Documentation

◆ $context

Context TYPO3\CMS\Core\Middleware\BackendUserAuthenticator::$context
protected