Project

General

Profile

Actions

Feature #99311

open

Add a redirect option in FrontendUserAuthenticator Middleware

Added by Aristeidis Karavas almost 2 years ago. Updated 4 months ago.

Status:
New
Priority:
Should have
Assignee:
Category:
Miscellaneous
Start date:
2022-12-08
Due date:
% Done:

0%

Estimated time:
PHP Version:
8.1
Tags:
login, middleware, frontend-login
Complexity:
easy
Sprint Focus:

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.

Actions #1

Updated by Benni Mack over 1 year ago

  • Target version changed from 12 LTS to Candidate for Major Version
Actions #2

Updated by Georg Ringer 4 months ago

  • Assignee set to Benni Mack
Actions

Also available in: Atom PDF