简体   繁体   中英

TYPO3 v10.2: Frontend user session saving ($GLOBALS['TSFE']->fe_user) in Custom Authentication Service

Right now I am upgrading an old pibased Extension from 6.2 to an extbase 10.2 Extension. After some research I found out that the Request Workflow for Frontend Requests has changed in TYPO3 10.0 (Issue #88540). From the Changelog:

TSFE is instantiated after all site resolving, authentication, page resolving and argument validation is done.

Since I used to store user sessions in $GLOBALS['TSFE']->fe_user with $GLOBALS['TSFE']->fe_user->setKey('ses','key', $value) while authentication process (Custom authService) I am not able to store it anymore because of the changed request workflow. $GLOBALS['TSFE']->fe_user is now instantiated after the authentication process. It seems like that saving frontend user session has to be moved into Middleware (found some Information here: Task #88541). Since I never dealt with Middlewares, my Question now is how I can achive saving my frontend user session data by using a middleware Class? Under Configuration\\RequestMiddlewares.php I got following config:

return [
    'frontend' => [
        'my-middleware-identifier' => [
            'target' => \Vendor\Extension\Middleware\Session::class,
            'after' => [
                'typo3/cms-frontend/prepare-tsfe-rendering'
            ]
        ]
    ]
];

Thanks in advance!

Since TYPO3 v10.0.0 the Request Workflow for Frontend Requests has changed. That's why it isn't possible anymore to store session data during the authentication process. See: Changed Request Workflow for Frontend Requests I used a custom middleware for this to store it after the $GLOBALS['TSFE']->fe_user has been created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM