Skip to content
Merged
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
6 changes: 6 additions & 0 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

- Debug mode (`debugMode=true`) now validates the ticket with the query parameters login used to issue it,
so it works for a service given as `TARGET` and with `renew` set, and ignores parameters in the request body (Marko Ivančić)
- Debug mode no longer passes the validation XML to the error template for an unsupported debug mode
(the `str_contains()` check for the error template had its arguments reversed)

### Changed

- The test suite now reports deprecations, including those triggered with `@` such as Symfony's `trigger_deprecation()`

## [7.0.6] - 2026-11-10

Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
backupGlobals="false"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
cacheDirectory=".phpunit.cache">
<coverage>
<report>
Expand All @@ -19,7 +20,7 @@
</testsuite>
</testsuites>
<logging/>
<source>
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory suffix=".php">./src</directory>
</include>
Expand Down
7 changes: 4 additions & 3 deletions src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,18 @@ public function __construct(
* @param bool $renew
* @param bool $gateway
* @param string|null $service
* @param string|null $TARGET Query parameter name for "service" used by older CAS clients'
* @param string|null $TARGET Query parameter name for "service" used by older CAS clients'
* @param string|null $scope
* @param string|null $language
* @param string|null $entityId
* @param string|null $debugMode
* @param string|null $method
* @param string|null $pgtUrl Only used by debug mode, which passes it on to the ticket validation
* @param string|null $pgtUrl Only used by debug mode, which passes it on to the ticket validation
*
* @return \SimpleSAML\HTTP\RunnableResponse|\SimpleSAML\XHTML\Template
* @throws \SimpleSAML\Error\ConfigurationError
* @throws \SimpleSAML\Error\NoState
* @throws \Exception
*/
public function login(
Request $request,
Expand Down Expand Up @@ -268,7 +269,7 @@ public function login(
);
$t = new Template($this->sspConfig, (string)$templateName);
$t->data['debugMode'] = $debugMode === 'true' ? 'Default' : $debugMode;
if (!str_contains('error', (string)$templateName)) {
if (!str_contains((string)$templateName, 'error')) {
$t->data['DebugModeXml'] = $DebugModeXmlString;
}
$t->data['statusCode'] = $statusCode;
Expand Down
24 changes: 24 additions & 0 deletions tests/src/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,30 @@ public function testDebugModeIgnoresTheRequestBody(array $queryParams, array $bo
}


/**
* An unsupported debug mode renders the error template, without any XML to show.
*
* @throws \Exception
*/
public function testUnsupportedDebugModeRendersTheErrorWithoutXml(): void
{
$requestParams = [
'service' => 'https://example.com/ssp/module.php/cas/linkback.php',
'debugMode' => 'unsupported',
];
$loginRequest = Request::create(
uri: Module::getModuleURL('casserver/login'),
parameters: $requestParams,
);
$response = $this->callLogin($this->createDebugModeController(), $loginRequest, $requestParams);

$this->assertInstanceOf(Template::class, $response);
$this->assertSame(Response::HTTP_BAD_REQUEST, $response->data['statusCode']);
$this->assertSame('unsupported', $response->data['debugMode']);
$this->assertArrayNotHasKey('DebugModeXml', $response->data);
}


/**
* A controller with debug mode enabled, for a user with an SSO session.
*/
Expand Down
Loading