From 25c3b4563217209353369bfa7b78cf95c7ebacfa Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tim.dijen@minbzk.nl> Date: Mon, 29 Jul 2019 14:42:02 +0200 Subject: [PATCH] Optionally return expired entities --- lib/SimpleSAML/Metadata/MetaDataStorageHandler.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php index 9c1476709..cbd5dbddb 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php @@ -142,10 +142,11 @@ class MetaDataStorageHandler implements \SimpleSAML\Utils\ClearableState * where the key is the entity id. * * @param string $set The set we want to list metadata from. + * @param bool $showExpired A boolean specifying whether expired entities should be returned * * @return array An associative array with the metadata from from the given set. */ - public function getList($set = 'saml20-idp-remote') + public function getList($set = 'saml20-idp-remote', $showExpired = false) { assert(is_string($set)); @@ -154,9 +155,9 @@ class MetaDataStorageHandler implements \SimpleSAML\Utils\ClearableState foreach ($this->sources as $source) { $srcList = $source->getMetadataSet($set); - foreach ($srcList as $key => $le) { - if (array_key_exists('expire', $le)) { - if ($le['expire'] < time()) { + if ($showExpired === false) { + foreach ($srcList as $key => $le) { + if (array_key_exists('expire', $le) && ($le['expire'] < time())) { unset($srcList[$key]); Logger::warning( "Dropping metadata entity ".var_export($key, true).", expired ". -- GitLab