Skip to content

Commit da9cf20

Browse files
committed
Bugfix: fix override over errorURL
1 parent d33f906 commit da9cf20

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

docs/simplesamlphp-changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Released TBD
1818
and SP metadata files (#2470)
1919
* Fix auth state AuthnInstant (#2478)
2020
* Allow "Secure" cookie attribute via HTTP on localhost (#2483)
21+
* Fix override over errorURL
2122

2223
## Version 2.4.2
2324

modules/saml/src/IdP/SAML2.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,11 @@ public static function getHostedMetadata(string $entityid, ?MetaDataStorageHandl
961961
$metadata['RegistrationInfo'] = $config->getArray('RegistrationInfo');
962962
}
963963

964+
// Override errorURL if set
965+
if ($config->hasValue('errorURL')) {
966+
$metadata['errorURL'] = $config->getString('errorURL');
967+
}
968+
964969
// configure signature options
965970
if ($config->hasValue('validate.authnrequest')) {
966971
$metadata['sign.authnrequest'] = $config->getBoolean('validate.authnrequest');

tests/modules/saml/src/IdP/SAML2Test.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,20 @@ private function idpMetadataHandlerHelper(array $metadata, array $extraconfig =
262262
return SAML2::getHostedMetadata($metadata['entityid']);
263263
}
264264

265+
266+
/**
267+
* Test that an override for the errorURL produced the expected output.
268+
*/
269+
public function testIdPGetHostedMetadataErrorUrlOverride(): void
270+
{
271+
$md = [
272+
'errorURL' => 'https://simplesamlphp.org',
273+
];
274+
$hostedMd = $this->idpMetadataHandlerHelper($md);
275+
$this->assertEquals('https://simplesamlphp.org', $hostedMd['errorURL']);
276+
}
277+
278+
265279
/**
266280
* A minimally configured hosted IdP has all default fields with expected values.
267281
*/

0 commit comments

Comments
 (0)