Frontend user

The frontend.user frontend request attribute provides the \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication object.

The topic is described in depth in chapter Authentication.

Example:

EXT:my_extension/Classes/Service/MyService.php
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;

public function doSomethingToFrontendUser(ServerRequestInterface $request): void
{
    /** @var FrontendUserAuthentication $frontendUserAuthentification */
    $frontendUserAuthentification = $request->getAttribute('frontend.user');
    $frontendUserAuthentification->fetchGroupData($request);
    // do something
}
Copied!