From 77d72b5be7c7c979268d7a691f8f9e9224fa8423 Mon Sep 17 00:00:00 2001
From: m0ark <33390109+m0ark@users.noreply.github.com>
Date: Wed, 18 Apr 2018 15:29:43 +0200
Subject: [PATCH] Update MetaDataStorageSource.php

Now using DiscoHints->IPHint to support specified SAML extension for IdP discovery
---
 lib/SimpleSAML/Metadata/MetaDataStorageSource.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php
index bc96feeec..74822bdbf 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php
@@ -159,7 +159,7 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource
 
 
     /**
-     * This function will go through all the metadata, and check the hint.cidr
+     * This function will go through all the metadata, and check the DiscoHints->IPHint
      * parameter, which defines a network space (ip range) for each remote entry.
      * This function returns the entityID for any of the entities that have an
      * IP range which the IP falls within.
@@ -178,14 +178,17 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource
 
         foreach ($metadataSet as $index => $entry) {
 
-            if (!array_key_exists('hint.cidr', $entry)) {
+            if (!array_key_exists('DiscoHints', $entry)) {
                 continue;
             }
-            if (!is_array($entry['hint.cidr'])) {
+            if (!array_key_exists('IPHint', $entry['DiscoHints'])) {
+                continue;
+            }
+            if (!is_array($entry['DiscoHints']['IPHint'])) {
                 continue;
             }
 
-            foreach ($entry['hint.cidr'] as $hint_entry) {
+            foreach ($entry['DiscoHints']['IPHint'] as $hint_entry) {
                 if (SimpleSAML\Utils\Net::ipCIDRcheck($hint_entry, $ip)) {
                     if ($type === 'entityid') {
                         return $entry['entityid'];
-- 
GitLab