Issue Feature Rejected

#99311Add a redirect option in FrontendUserAuthenticator Middleware

Aristeidis Karavas 12/08/22, 09:47 updated 04/11/25, 10:37

Description

Using a custom oAuth2 Login, i tried to create a login via Discord. I set the logintype, then i created my Authentication Service, everything worked great. What i missed though is the redirect option. Once the TYPO3\CMS\Frontend\Middleware\FrontendUserAuthenticator kicks in and once the login is successful, the middleware just returns the response, without the option to redirect somewhere.

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/Middleware/FrontendUserAuthenticator.php#L91

What i am thinking of as an MVP, is maybe a redirect GET parameter which is going to be validated just before the returned response. If it is there, then return the response with an extra Location: header. Maybe something like that:


if (count($request->getQueryParams()) > 0 && array_key_exists('redirect', $request->getQueryParams()))
   $response = $this->responseFactory->createResponse()
         ->withHeader('Location', $request->getQueryParams()['redirect']);
    return $response;
}

After the MVP, i am thinking of maybe a redirect which is generated via a pid. Instead of passing a whole URL in the redirect parameter, maybe a PID could be passed and then the Middleware could resolve this pid.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.