33        assert(is_array($sourcesConfig));
 
   37        foreach ($sourcesConfig as $sourceConfig) {
 
   38            if (!is_array($sourceConfig)) {
 
   39                throw new Exception(
"Found an element in metadata source configuration which wasn't an array.");
 
   62        assert(is_array($sourceConfig));
 
   64        if (array_key_exists(
'type', $sourceConfig)) {
 
   65            $type = $sourceConfig[
'type'];
 
   79                return new \SimpleSAML\Metadata\Sources\MDQ($sourceConfig);
 
   88                        'SimpleSAML_Metadata_MetaDataStorageSource' 
   90                } 
catch (Exception $e) {
 
   92                        "Invalid 'type' for metadata source. Cannot find store '$type'.",
 
   96                return new $className($sourceConfig);
 
  136        if ($metadataSet === 
null) {
 
  141        foreach ($metadataSet as 
$index => $entry) {
 
  142            if (!array_key_exists(
'host', $entry)) {
 
  146            if ($hostPath === $entry[
'host']) {
 
  147                if (
$type === 
'entityid') {
 
  148                    return $entry[
'entityid'];
 
  178        foreach ($metadataSet as 
$index => $entry) {
 
  179            $cidrHints = array();
 
  182            if (array_key_exists(
'hint.cidr', $entry) && is_array($entry[
'hint.cidr'])) {
 
  183                $cidrHints = $entry[
'hint.cidr'];
 
  187            if (array_key_exists(
'DiscoHints', $entry) 
 
  188                && array_key_exists(
'IPHint', $entry[
'DiscoHints']) 
 
  189                && is_array($entry[
'DiscoHints'][
'IPHint'])) {
 
  191                $cidrHints = array_merge($entry[
'DiscoHints'][
'IPHint'], $cidrHints);
 
  194            if (empty($cidrHints)) {
 
  198            foreach ($cidrHints as $hint_entry) {
 
  199                if (
SimpleSAML\Utils\Net::ipCIDRcheck($hint_entry, $ip)) {
 
  200                    if (
$type === 
'entityid') {
 
  201                        return $entry[
'entityid'];
 
  227        foreach ($metadataSet as 
$index => $entry) {
 
  232                if ($entry[
'host'] === 
'__DEFAULT__' || $entry[
'host'] === $currenthost) {
 
  259        assert(is_string(
$index));
 
  264        if (array_key_exists(
$index, $metadataSet)) {
 
  265            return $metadataSet[
$index];
 
  269        if (isset($indexlookup) && array_key_exists($indexlookup, $metadataSet)) {
 
  270            return $metadataSet[$indexlookup];
 
An exception for terminatinating execution or to throw for unit testing.
static resolveClass($id, $type, $subclass=null)
Resolve module class.
static getSelfHost()
Retrieve our own host.
Attribute-related utility methods.