Skip to content

Commit 4271f44

Browse files
committed
Fix CAS ReturnTo URL to always point to casserver/login and update login tests accordingly
1 parent a711377 commit 4271f44

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/Controller/LoginController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ public function getReturnUrl(Request $request, ?array $sessionTicket): string
352352
// Parse the query parameters and return them in an array
353353
$query = $this->parseQueryParameters($request, $sessionTicket);
354354
// Construct the ReturnTo URL
355-
return $this->httpUtils->getSelfURLNoQuery() . '?' . http_build_query($query);
355+
$returnToBase = Module::getModuleURL('casserver/login');
356+
return $returnToBase . '?' . http_build_query($query);
356357
}
357358

358359

tests/src/Controller/LoginControllerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function loginOnAuthenticateParameters(): array
137137
'ForceAuthn' => false,
138138
'isPassive' => false,
139139
// phpcs:ignore Generic.Files.LineLength.TooLong
140-
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php',
140+
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php',
141141
],
142142
[],
143143
],
@@ -151,7 +151,7 @@ public static function loginOnAuthenticateParameters(): array
151151
'ForceAuthn' => false,
152152
'isPassive' => false,
153153
// phpcs:ignore Generic.Files.LineLength.TooLong
154-
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&entityId=http%3A%2F%2Flocalhost%2FentityId%2Fsso',
154+
'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',
155155
],
156156
[],
157157
],
@@ -164,7 +164,7 @@ public static function loginOnAuthenticateParameters(): array
164164
'ForceAuthn' => false,
165165
'isPassive' => false,
166166
// phpcs:ignore Generic.Files.LineLength.TooLong
167-
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
167+
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
168168
'saml:IDPList' => [
169169
'http://localhost/entityId/sso/scope/A',
170170
'http://localhost/entityId/sso/scope/B',
@@ -187,7 +187,7 @@ public static function loginOnAuthenticateParameters(): array
187187
'ForceAuthn' => false,
188188
'isPassive' => false,
189189
// phpcs:ignore Generic.Files.LineLength.TooLong
190-
'ReturnTo' => 'http://localhost/?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
190+
'ReturnTo' => 'http://localhost/module.php/casserver/login?service=https%3A%2F%2Fexample.com%2Fssp%2Fmodule.php%2Fcas%2Flinkback.php&scope=desktop',
191191
'saml:idp' => 'http://localhost/entityId/sso/scope/A',
192192
],
193193
[

0 commit comments

Comments
 (0)