Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ public function getReturnUrl(Request $request, ?array $sessionTicket): string
// Parse the query parameters and return them in an array
$query = $this->parseQueryParameters($request, $sessionTicket);
// Construct the ReturnTo URL
return $this->httpUtils->getSelfURLNoQuery() . '?' . http_build_query($query);
$returnToBase = Module::getModuleURL('casserver/login');
return $returnToBase . '?' . http_build_query($query);
Copy link
Member

@tvdijen tvdijen Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be giving the exact same result?
If this is not the case, I think it might be better to rely on Symfony's request object and use $request->getBaseUrl() instead of our own http-utils

}


Expand Down
8 changes: 4 additions & 4 deletions tests/src/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static function loginOnAuthenticateParameters(): array
'ForceAuthn' => false,
'isPassive' => false,
// phpcs:ignore Generic.Files.LineLength.TooLong
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php',
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php',
],
[],
],
Expand All @@ -151,7 +151,7 @@ public static function loginOnAuthenticateParameters(): array
'ForceAuthn' => false,
'isPassive' => false,
// phpcs:ignore Generic.Files.LineLength.TooLong
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&entityId=http%3A%2F%2Flocalhost%2FentityId%2Fsso',
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&entityId=http%3A%2F%2Flocalhost%2FentityId%2Fsso',
],
[],
],
Expand All @@ -164,7 +164,7 @@ public static function loginOnAuthenticateParameters(): array
'ForceAuthn' => false,
'isPassive' => false,
// phpcs:ignore Generic.Files.LineLength.TooLong
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
'saml:IDPList' => [
'http://localhost/entityId/sso/scope/A',
'http://localhost/entityId/sso/scope/B',
Expand All @@ -187,7 +187,7 @@ public static function loginOnAuthenticateParameters(): array
'ForceAuthn' => false,
'isPassive' => false,
// phpcs:ignore Generic.Files.LineLength.TooLong
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
'saml:idp' => 'http://localhost/entityId/sso/scope/A',
],
[
Expand Down