Skip to content
Snippets Groups Projects
Unverified Commit eb4df65f authored by Thijs Kinkhorst's avatar Thijs Kinkhorst Committed by GitHub
Browse files

Merge pull request #1173 from simplesamlphp/tvdijen-patch-expired-entities

Show expired entities in federation-page
parents f970fb1d 3c85b5b3
No related branches found
No related tags found
No related merge requests found
...@@ -142,10 +142,11 @@ class MetaDataStorageHandler implements \SimpleSAML\Utils\ClearableState ...@@ -142,10 +142,11 @@ class MetaDataStorageHandler implements \SimpleSAML\Utils\ClearableState
* where the key is the entity id. * where the key is the entity id.
* *
* @param string $set The set we want to list metadata from. * @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. * @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)); assert(is_string($set));
...@@ -154,9 +155,9 @@ class MetaDataStorageHandler implements \SimpleSAML\Utils\ClearableState ...@@ -154,9 +155,9 @@ class MetaDataStorageHandler implements \SimpleSAML\Utils\ClearableState
foreach ($this->sources as $source) { foreach ($this->sources as $source) {
$srcList = $source->getMetadataSet($set); $srcList = $source->getMetadataSet($set);
foreach ($srcList as $key => $le) { if ($showExpired === false) {
if (array_key_exists('expire', $le)) { foreach ($srcList as $key => $le) {
if ($le['expire'] < time()) { if (array_key_exists('expire', $le) && ($le['expire'] < time())) {
unset($srcList[$key]); unset($srcList[$key]);
Logger::warning( Logger::warning(
"Dropping metadata entity ".var_export($key, true).", expired ". "Dropping metadata entity ".var_export($key, true).", expired ".
......
...@@ -69,14 +69,14 @@ class FederationController ...@@ -69,14 +69,14 @@ class FederationController
$entries = [ $entries = [
'hosted' => array_merge($hostedSPs, $hostedIdPs), 'hosted' => array_merge($hostedSPs, $hostedIdPs),
'remote' => [ 'remote' => [
'saml20-idp-remote' => !empty($hostedSPs) ? $this->mdHandler->getList('saml20-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') : [], 'shib13-idp-remote' => !empty($hostedSPs) ? $this->mdHandler->getList('shib13-idp-remote', true) : [],
'saml20-sp-remote' => $this->config->getBoolean('enable.saml20-idp', false) === 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 '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) && '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) : [],
], ],
]; ];
......
...@@ -51,8 +51,8 @@ $metaentries = ['hosted' => $metadataHosted, 'remote' => []]; ...@@ -51,8 +51,8 @@ $metaentries = ['hosted' => $metadataHosted, 'remote' => []];
if ($isadmin) { if ($isadmin) {
$metaentries['remote']['saml20-idp-remote'] = $metadata->getList('saml20-idp-remote'); $metaentries['remote']['saml20-idp-remote'] = $metadata->getList('saml20-idp-remote', true);
$metaentries['remote']['shib13-idp-remote'] = $metadata->getList('shib13-idp-remote'); $metaentries['remote']['shib13-idp-remote'] = $metadata->getList('shib13-idp-remote', true);
} }
if ($config->getBoolean('enable.saml20-idp', false) === true) { if ($config->getBoolean('enable.saml20-idp', false) === true) {
...@@ -61,7 +61,7 @@ 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'] = $metaentries['hosted']['saml20-idp']['metadata-url'] =
$config->getBasePath().'saml2/idp/metadata.php?output=xhtml'; $config->getBasePath().'saml2/idp/metadata.php?output=xhtml';
if ($isadmin) { 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) { } catch (Exception $e) {
\SimpleSAML\Logger::error('Federation: Error loading saml20-idp: '.$e->getMessage()); \SimpleSAML\Logger::error('Federation: Error loading saml20-idp: '.$e->getMessage());
...@@ -73,7 +73,7 @@ if ($config->getBoolean('enable.shib13-idp', false) === true) { ...@@ -73,7 +73,7 @@ if ($config->getBoolean('enable.shib13-idp', false) === true) {
$metaentries['hosted']['shib13-idp']['metadata-url'] = $metaentries['hosted']['shib13-idp']['metadata-url'] =
$config->getBasePath().'shib13/idp/metadata.php?output=xhtml'; $config->getBasePath().'shib13/idp/metadata.php?output=xhtml';
if ($isadmin) { 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) { } catch (Exception $e) {
\SimpleSAML\Logger::error('Federation: Error loading shib13-idp: '.$e->getMessage()); \SimpleSAML\Logger::error('Federation: Error loading shib13-idp: '.$e->getMessage());
...@@ -87,7 +87,7 @@ if ($config->getBoolean('enable.adfs-idp', false) === true) { ...@@ -87,7 +87,7 @@ if ($config->getBoolean('enable.adfs-idp', false) === true) {
['output' => 'xhtml'] ['output' => 'xhtml']
); );
if ($isadmin) { 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) { } catch (Exception $e) {
\SimpleSAML\Logger::error('Federation: Error loading adfs-idp: '.$e->getMessage()); \SimpleSAML\Logger::error('Federation: Error loading adfs-idp: '.$e->getMessage());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment