SimpleSAML_Metadata_MetaDataStorageHandler::getList PHP Method

getList() public method

This function lists all known metadata in the given set. It is returned as an associative array where the key is the entity id.
public getList ( string $set = 'saml20-idp-remote' ) : array
$set string The set we want to list metadata from.
return array An associative array with the metadata from from the given set.
    public function getList($set = 'saml20-idp-remote')
    {
        assert('is_string($set)');
        $result = array();
        foreach ($this->sources as $source) {
            $srcList = $source->getMetadataSet($set);
            foreach ($srcList as $key => $le) {
                if (array_key_exists('expire', $le)) {
                    if ($le['expire'] < time()) {
                        unset($srcList[$key]);
                        SimpleSAML\Logger::warning("Dropping metadata entity " . var_export($key, true) . ", expired " . SimpleSAML\Utils\Time::generateTimestamp($le['expire']) . ".");
                    }
                }
            }
            /* $result is the last argument to array_merge because we want the content already
             * in $result to have precedence.
             */
            $result = array_merge($srcList, $result);
        }
        return $result;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Retrieve the list of IdPs which are stored in the metadata.
  *
  * @return array An array with entityid => metadata mappings.
  */
 protected function getIdPList()
 {
     $idpList = array();
     foreach ($this->metadataSets as $metadataSet) {
         $newList = $this->metadata->getList($metadataSet);
         /*
          * Note that we merge the entities in reverse order. This ensures that it is the entity in the first
          * metadata set that "wins" if two metadata sets have the same entity.
          */
         $idpList = array_merge($newList, $idpList);
     }
     return $idpList;
 }