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
2 changes: 2 additions & 0 deletions config/module_casserver.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ $config = [
* as $state['Source']['entityid']. Filters that key off the authenticating entity (federation
* logging such as F-ticks, per-entity authorization, audit trails) need it. The requesting CAS
* service URL is made available to the same filters as $state['Destination']['entityid'].
* The authentication source gets both in the login state before the user logs in, so that it can
* report a failed login against them.
*
* NOTE: this is unrelated to the ?entityId= query parameter of the login endpoint, which selects
* which upstream SAML IdP the authsource should authenticate against.
Expand Down
9 changes: 5 additions & 4 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

## [Unreleased]

### Changed

- Give the authentication source Source and Destination before login, so that it can report a failed login against them (Marko Ivančić)
- The test suite now reports deprecations, including those triggered with `@` such as Symfony's `trigger_deprecation()`

### Fixed

- 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

### Security
Expand Down
5 changes: 3 additions & 2 deletions src/Cas/AttributeExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ protected function runAuthProcs(array &$state): void


/**
* Resolve the entity ID that casserver presents to the authproc filters as the authenticating IdP.
* Resolve the entity ID that casserver presents as the authenticating IdP, to the authentication
* source before login and to the authproc filters after it.
*
* casserver has no entity ID of its own, so the value is resolved in the following order:
* whatever the state already carries, then the 'idp_entity_id' configuration option, and finally
Expand All @@ -152,7 +153,7 @@ protected function runAuthProcs(array &$state): void
* @return string
* @throws \Exception
*/
private function resolveIdpEntityId(mixed $stateEntityId): string
public function resolveIdpEntityId(mixed $stateEntityId = null): string
{
if (\is_string($stateEntityId) && $stateEntityId !== '') {
return $stateEntityId;
Expand Down
15 changes: 15 additions & 0 deletions src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public function login(
forceAuthn: $forceAuthn,
returnToUrl: $returnToUrl,
entityId: $entityId,
serviceUrl: $serviceUrl,
);
}

Expand Down Expand Up @@ -523,19 +524,22 @@ private function instantiateClassDependencies(): void
* @param bool $forceAuthn
* @param string $returnToUrl
* @param string|null $entityId
* @param string|null $serviceUrl
*
* @return \SimpleSAML\HTTP\RunnableResponse
*/
private function handleInteractiveAuthenticate(
bool $forceAuthn,
string $returnToUrl,
?string $entityId,
?string $serviceUrl,
): RunnableResponse {
return $this->handleAuthenticate(
forceAuthn: $forceAuthn,
gateway: false,
returnToUrl: $returnToUrl,
entityId: $entityId,
serviceUrl: $serviceUrl,
);
}

Expand Down Expand Up @@ -570,6 +574,7 @@ private function handleUnauthenticatedGateway(
gateway: true,
returnToUrl: $returnToUrl,
entityId: $entityId,
serviceUrl: $serviceUrl,
);
}

Expand All @@ -581,6 +586,7 @@ private function handleUnauthenticatedGateway(
* @param bool $gateway Whether authentication should be passive/non-interactive
* @param string $returnToUrl URL to return to after authentication
* @param string|null $entityId Optional specific IdP entity ID to use
* @param string|null $serviceUrl The requesting CAS service, if the request names one
*
* @return \SimpleSAML\HTTP\RunnableResponse Response containing the login redirect
*/
Expand All @@ -589,13 +595,22 @@ private function handleAuthenticate(
bool $gateway,
string $returnToUrl,
?string $entityId,
?string $serviceUrl,
): RunnableResponse {
$params = [
'ForceAuthn' => $forceAuthn,
'isPassive' => $gateway,
'ReturnTo' => $returnToUrl,
// The same entities the authproc filters see after a successful login, so that an authentication
// source can report a failed login against them. They end with the login state: a session does not
// keep them, so they do not bind it to this service.
'Source' => ['entityid' => $this->attributeExtractor->resolveIdpEntityId()],
];

if (!empty($serviceUrl)) {
$params['Destination'] = ['entityid' => $serviceUrl];
}

if (isset($entityId)) {
$params['saml:idp'] = $entityId;
}
Expand Down
Loading
Loading