diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
index 9c147670923d0daaa8773fd47eac1af78f05139b..cbd5dbddb70f0444a8450c7682b6514459117228 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 ".
diff --git a/modules/admin/lib/FederationController.php b/modules/admin/lib/FederationController.php
index 17d5744c0d13decdd5456f33eb81b95f12217076..8803ab6c9860cd4d17666d7452d874cfa30253ed 100644
--- a/modules/admin/lib/FederationController.php
+++ b/modules/admin/lib/FederationController.php
@@ -69,14 +69,14 @@ class FederationController
         $entries = [
             'hosted' => array_merge($hostedSPs, $hostedIdPs),
             'remote' => [
-                'saml20-idp-remote' => !empty($hostedSPs) ? $this->mdHandler->getList('saml20-idp-remote') : [],
-                'shib13-idp-remote' => !empty($hostedSPs) ? $this->mdHandler->getList('shib13-idp-remote') : [],
+                'saml20-idp-remote' => !empty($hostedSPs) ? $this->mdHandler->getList('saml20-idp-remote', true) : [],
+                'shib13-idp-remote' => !empty($hostedSPs) ? $this->mdHandler->getList('shib13-idp-remote', true) : [],
                 'saml20-sp-remote' => $this->config->getBoolean('enable.saml20-idp', false) === true
-                    ? $this->mdHandler->getList('saml20-sp-remote') : [],
+                    ? $this->mdHandler->getList('saml20-sp-remote', true) : [],
                 'shib13-sp-remote' => $this->config->getBoolean('enable.shib13-idp', false) === true
-                    ? $this->mdHandler->getList('shib13-sp-remote') : [],
+                    ? $this->mdHandler->getList('shib13-sp-remote', true) : [],
                 'adfs-sp-remote' => ($this->config->getBoolean('enable.adfs-idp', false) === true) &&
-                    Module::isModuleEnabled('adfs') ? $this->mdHandler->getList('adfs-sp-remote') : [],
+                    Module::isModuleEnabled('adfs') ? $this->mdHandler->getList('adfs-sp-remote', true) : [],
             ],
         ];
 
diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php
index 267a54a53ff1c0911924375e53cf60a6562d656f..6376d06e65cff838f565b581a0ab91bb8e3bb64a 100644
--- a/modules/core/www/frontpage_federation.php
+++ b/modules/core/www/frontpage_federation.php
@@ -51,8 +51,8 @@ $metaentries = ['hosted' => $metadataHosted, 'remote' => []];
 
 
 if ($isadmin) {
-    $metaentries['remote']['saml20-idp-remote'] = $metadata->getList('saml20-idp-remote');
-    $metaentries['remote']['shib13-idp-remote'] = $metadata->getList('shib13-idp-remote');
+    $metaentries['remote']['saml20-idp-remote'] = $metadata->getList('saml20-idp-remote', true);
+    $metaentries['remote']['shib13-idp-remote'] = $metadata->getList('shib13-idp-remote', true);
 }
 
 if ($config->getBoolean('enable.saml20-idp', false) === true) {
@@ -61,7 +61,7 @@ if ($config->getBoolean('enable.saml20-idp', false) === true) {
         $metaentries['hosted']['saml20-idp']['metadata-url'] =
             $config->getBasePath().'saml2/idp/metadata.php?output=xhtml';
         if ($isadmin) {
-            $metaentries['remote']['saml20-sp-remote'] = $metadata->getList('saml20-sp-remote');
+            $metaentries['remote']['saml20-sp-remote'] = $metadata->getList('saml20-sp-remote', true);
         }
     } catch (Exception $e) {
         \SimpleSAML\Logger::error('Federation: Error loading saml20-idp: '.$e->getMessage());
@@ -73,7 +73,7 @@ if ($config->getBoolean('enable.shib13-idp', false) === true) {
         $metaentries['hosted']['shib13-idp']['metadata-url'] =
             $config->getBasePath().'shib13/idp/metadata.php?output=xhtml';
         if ($isadmin) {
-            $metaentries['remote']['shib13-sp-remote'] = $metadata->getList('shib13-sp-remote');
+            $metaentries['remote']['shib13-sp-remote'] = $metadata->getList('shib13-sp-remote', true);
         }
     } catch (Exception $e) {
         \SimpleSAML\Logger::error('Federation: Error loading shib13-idp: '.$e->getMessage());
@@ -87,7 +87,7 @@ if ($config->getBoolean('enable.adfs-idp', false) === true) {
             ['output' => 'xhtml']
         );
         if ($isadmin) {
-            $metaentries['remote']['adfs-sp-remote'] = $metadata->getList('adfs-sp-remote');
+            $metaentries['remote']['adfs-sp-remote'] = $metadata->getList('adfs-sp-remote', true);
         }
     } catch (Exception $e) {
         \SimpleSAML\Logger::error('Federation: Error loading adfs-idp: '.$e->getMessage());