aboutsummaryrefslogtreecommitdiff
path: root/lib/middleware
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-06-26 09:37:24 +0200
committerDavid Siegfried <david.siegfried@uni-vechta.de>2025-06-26 07:37:24 +0000
commit0c42d68a7009794b0cd6589e9944c66304d9eeb8 (patch)
tree8ec50682749efc0f2349a51b5a03665443c0c5b6 /lib/middleware
parent4f60c4922ed96d60c0fa3b77a590e355b21841ca (diff)
keep redirect url in sso as well, provide constant for default kept variables, fixes #5593
Closes #5593 Merge request studip/studip!4270
Diffstat (limited to 'lib/middleware')
-rw-r--r--lib/middleware/AuthenticationMiddleware.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/middleware/AuthenticationMiddleware.php b/lib/middleware/AuthenticationMiddleware.php
index 10de004..5792e15 100644
--- a/lib/middleware/AuthenticationMiddleware.php
+++ b/lib/middleware/AuthenticationMiddleware.php
@@ -23,13 +23,23 @@ use Studip\Authentication\Manager;
final class AuthenticationMiddleware implements MiddlewareInterface
{
- public function __construct(private Manager $auth_manager, private ResponseFactoryInterface $response_factory)
- {
+ public function __construct(
+ private readonly Manager $auth_manager,
+ private readonly ResponseFactoryInterface $response_factory
+ ) {
}
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if ($this->auth_manager->start()) {
+ if (isset($_SESSION['redirect_after_login'] )) {
+ $redirect = $_SESSION['redirect_after_login'];
+ unset($_SESSION['redirect_after_login']);
+
+ return $this->response_factory->createResponse(302)
+ ->withHeader('Location', $redirect);
+ }
+
return $handler->handle($request);
} else {
if (!match_route('dispatch.php/start')) {