BackendUserAuthenticator implements MiddlewareInterface

AbstractYes

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);
}
Internal

this class might get merged again with the subclasses

Table of Contents

Interfaces

MiddlewareInterface

Properties

$context  : Context

Methods

__construct()  : mixed
process()  : ResponseInterface
applyHeadersToResponse()  : ResponseInterface
Adding headers to the response to avoid caching on the client side.
setBackendUserAspect()  : void
Register the backend user as aspect

Properties

Methods

process()

public abstract process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface

applyHeadersToResponse()

Adding headers to the response to avoid caching on the client side.

protected applyHeadersToResponse(ResponseInterface $response) : ResponseInterface

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
$response : ResponseInterface
Return values
ResponseInterface

the modified response object.


        
On this page

Search results