From 46e919be6afe11462389cb2fcae7e5f3a84d909a Mon Sep 17 00:00:00 2001 From: Andre Menrath Date: Tue, 5 May 2026 12:05:18 +0200 Subject: [PATCH 1/5] fix: adjust configuration getters to SimpleSAMLphp refactor --- locallib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/locallib.php b/locallib.php index 448c08cac..fd3c08448 100644 --- a/locallib.php +++ b/locallib.php @@ -39,7 +39,7 @@ function auth_saml2_get_sp_metadata($baseurl = '') { $sourceId = $saml2auth->spname; - $file = $saml2auth->get_file_sp_metadata_file($baseurl); + $file = $saml2auth->get_file_sp_metadata_file(); if (file_exists($file)) { $xml = file_get_contents($file); return $xml; @@ -146,40 +146,40 @@ function auth_saml2_get_sp_metadata($baseurl = '') { $metaArray20['NameIDFormat'] = $format; } - $name = $spconfig->getLocalizedString('name', NULL); - $attributes = $spconfig->getArray('attributes', array()); + $name = $spconfig->getOptionalLocalizedString('name', NULL); + $attributes = $spconfig->getOptionalArray('attributes', array()); if ($name !== NULL && !empty($attributes)) { $metaArray20['name'] = $name; $metaArray20['attributes'] = $attributes; - $metaArray20['attributes.required'] = $spconfig->getArray('attributes.required', array()); + $metaArray20['attributes.required'] = $spconfig->getOptionalArray('attributes.required', array()); if (empty($metaArray20['attributes.required'])) { unset($metaArray20['attributes.required']); } - $description = $spconfig->getArray('description', NULL); + $description = $spconfig->getOptionalArray('description', NULL); if ($description !== NULL) { $metaArray20['description'] = $description; } - $nameFormat = $spconfig->getString('attributes.NameFormat', NULL); + $nameFormat = $spconfig->getOptionalString('attributes.NameFormat', NULL); if ($nameFormat !== NULL) { $metaArray20['attributes.NameFormat'] = $nameFormat; } } // add organization info - $orgName = $spconfig->getLocalizedString('OrganizationName', NULL); + $orgName = $spconfig->getOptionalLocalizedString('OrganizationName', NULL); if ($orgName !== NULL) { $metaArray20['OrganizationName'] = $orgName; - $metaArray20['OrganizationDisplayName'] = $spconfig->getLocalizedString('OrganizationDisplayName', NULL); + $metaArray20['OrganizationDisplayName'] = $spconfig->getOptionalLocalizedString('OrganizationDisplayName', NULL); if ($metaArray20['OrganizationDisplayName'] === NULL) { $metaArray20['OrganizationDisplayName'] = $orgName; } - $metaArray20['OrganizationURL'] = $spconfig->getLocalizedString('OrganizationURL', NULL); + $metaArray20['OrganizationURL'] = $spconfig->getOptionalLocalizedString('OrganizationURL', NULL); if ($metaArray20['OrganizationURL'] === NULL) { throw new SimpleSAML_Error_Exception('If OrganizationName is set, OrganizationURL must also be set.'); } @@ -193,10 +193,10 @@ function auth_saml2_get_sp_metadata($baseurl = '') { } // add technical contact - $email = $config->getString('technicalcontact_email', 'na@example.org', FALSE); + $email = $config->getOptionalString('technicalcontact_email', FALSE); if ($email && $email !== 'na@example.org') { $techcontact['emailAddress'] = $email; - $techcontact['name'] = $config->getString('technicalcontact_name', NULL); + $techcontact['name'] = $config->getOptionalString('technicalcontact_name', NULL); $techcontact['contactType'] = 'technical'; $metaArray20['contacts'][] = \SimpleSAML\Utils\Config\Metadata::getContact($techcontact); } From e2da0b13f794a4d81ff1476126bcf8e92ed3b49c Mon Sep 17 00:00:00 2001 From: Andre Menrath Date: Tue, 5 May 2026 12:07:58 +0200 Subject: [PATCH 2/5] fix: align SimpleSAML_Error_Exception usage with SimpleSAMLphp refactor --- locallib.php | 1 + selectidp.php | 1 + 2 files changed, 2 insertions(+) diff --git a/locallib.php b/locallib.php index fd3c08448..2ab3b4b23 100644 --- a/locallib.php +++ b/locallib.php @@ -23,6 +23,7 @@ */ use auth_saml2\event\cert_regenerated; +use SimpleSAML\Error\Exception as SimpleSAML_Error_Exception; // @codingStandardsIgnoreStart /** diff --git a/selectidp.php b/selectidp.php index e24ada698..57315b1e1 100644 --- a/selectidp.php +++ b/selectidp.php @@ -24,6 +24,7 @@ */ use auth_saml2\admin\saml2_settings; +use SimpleSAML\Error\Exception as SimpleSAML_Error_Exception; // @codingStandardsIgnoreStart require_once(__DIR__ . '/../../config.php'); From 28d2ff7d77df8cfafb92025b7225ff0e3a82dc14 Mon Sep 17 00:00:00 2001 From: Andre Menrath Date: Tue, 5 May 2026 12:45:48 +0200 Subject: [PATCH 3/5] fix: usage of SimpleSAML\XHTML\Template see https://github.com/simplesamlphp/simplesamlphp/issues/1541 --- sp/metadata.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sp/metadata.php b/sp/metadata.php index dfe828747..18056b5ee 100644 --- a/sp/metadata.php +++ b/sp/metadata.php @@ -52,7 +52,7 @@ if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] == 'xhtml') { - $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); + $t = new SimpleSAML\XHTML\Template($config, 'metadata.php'); $t->data['header'] = 'saml20-sp'; $t->data['metadata'] = htmlspecialchars($xml); From 5982692f85afdb4ac51dff3b26db682c1255f513 Mon Sep 17 00:00:00 2001 From: Andre Menrath Date: Tue, 5 May 2026 12:47:28 +0200 Subject: [PATCH 4/5] misc: add type hint for auth source variable --- sp/metadata.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sp/metadata.php b/sp/metadata.php index 18056b5ee..c65664a68 100644 --- a/sp/metadata.php +++ b/sp/metadata.php @@ -26,6 +26,8 @@ * @package auth_saml2 * @copyright Brendan Heywood * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * + * @var \SimpleSAML\Module\saml\Auth\Source\SP $source The Service Provider Source definition. */ // @codingStandardsIgnoreStart From 3f9014d5904b4e5a0e0b0a02baef5ee652196909 Mon Sep 17 00:00:00 2001 From: Andre Menrath Date: Tue, 5 May 2026 12:51:44 +0200 Subject: [PATCH 5/5] fix: adjust usage of removed send function of SimpleSamlPHP XHTML template see https://github.com/simplesamlphp/simplesamlphp/pull/1281 --- sp/metadata.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sp/metadata.php b/sp/metadata.php index c65664a68..14284ff56 100644 --- a/sp/metadata.php +++ b/sp/metadata.php @@ -60,7 +60,7 @@ $t->data['metadata'] = htmlspecialchars($xml); $t->data['metadataflat'] = '$metadata[' . var_export($entityId, TRUE) . '] = ' . var_export($metaArray20, TRUE) . ';'; $t->data['metaurl'] = $source->getMetadataURL(); - $t->show(); + $t->send(); } else { // header('Content-Type: application/samlmetadata+xml'); header('Content-Type: text/xml');