BackendUserAuthenticator

class \TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator

Extends
BackendUserAuthenticator

Authenticates the request against the backend realm of the authentication pipeline, initializes $GLOBALS['BE_USER'] and the global LANG object, and provides the established principal as "backend.principal" request attribute and as token of the authorization checker while the request is handled.

Table of Contents

Properties

$context  : Context

Methods

__construct()  : mixed
process()  : ResponseInterface
Resolves the request to an authentication outcome and sets up $GLOBALS['BE_USER'] and $GLOBALS['LANG']
applyCookieToResponse()  : ResponseInterface
Applies the session cookie as evaluated by the authentication process to the response.
applyHeadersToResponse()  : ResponseInterface
Adding headers to the response to avoid caching on the client side.
enrichResponseWithHeadersAndCookieInformation()  : ResponseInterface
Backend requests should almost always apply Set-Cookie information and never be cacheable.
isLoggedInBackendUserRequired()  : bool
Check if the user is required for the request.
sessionGarbageCollection()  : void
Garbage collection for be_sessions (with a probability)
setBackendUserAspect()  : void
Register the backend user as aspect

Properties

Methods

__construct()

public __construct(Context $context, LanguageServiceFactory $languageServiceFactory, UriBuilder $uriBuilder, AuthenticatorManager $authenticatorManager, MfaChallengeResponseFactory $mfaChallengeResponseFactory, TokenStorageInterface $tokenStorage) : mixed

Parameters

$context : Context
$languageServiceFactory : LanguageServiceFactory
$uriBuilder : UriBuilder
$authenticatorManager : AuthenticatorManager
$mfaChallengeResponseFactory : MfaChallengeResponseFactory
$tokenStorage : TokenStorageInterface

process()

Resolves the request to an authentication outcome and sets up $GLOBALS['BE_USER'] and $GLOBALS['LANG']

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface

Parameters

$request : ServerRequestInterface
$handler : RequestHandlerInterface

Return values

ResponseInterface

applyCookieToResponse()

Applies the session cookie as evaluated by the authentication process to the response.

protected applyCookieToResponse(ResponseInterface $response, ServerRequestInterface $request, BackendUserAuthentication $userAuthentication) : ResponseInterface

Parameters

$response : ResponseInterface
$request : ServerRequestInterface
$userAuthentication : BackendUserAuthentication

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.

enrichResponseWithHeadersAndCookieInformation()

Backend requests should almost always apply Set-Cookie information and never be cacheable.

protected enrichResponseWithHeadersAndCookieInformation(ServerRequestInterface $request, ResponseInterface $response, BackendUserAuthentication|null $userAuthentication) : ResponseInterface

This is also needed if there is a redirect from somewhere in the code.

The cookie is omitted from the response, if no cookie is set and the user has not just been logged in, because that means we a) do not delete a cookie and b) must not delete a cookie that was omitted by the browser due to SameSite=strict handling in cross-site requests.

Parameters

$request : ServerRequestInterface
$response : ResponseInterface
$userAuthentication : BackendUserAuthentication|null

Tags

throws
AspectNotFoundException

Return values

ResponseInterface

isLoggedInBackendUserRequired()

Check if the user is required for the request.

protected isLoggedInBackendUserRequired(Route $route) : bool

Routes declared with the access "anonymous" (login, password reset, ...) don't require a user.

Parameters

$route : Route

the Route to check against

Return values

bool —

true when the Route requires an authenticated backend user

sessionGarbageCollection()

Garbage collection for be_sessions (with a probability)

protected sessionGarbageCollection() : void
On this page