summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
diff options
context:
space:
mode:
authorAndreas Åkre Solberg <andreas.solberg@uninett.no>2008-03-05 07:11:56 +0000
committerAndreas Åkre Solberg <andreas.solberg@uninett.no>2008-03-05 07:11:56 +0000
commitd89c8da19a62b0f578a489357c62daf42e2209cf (patch)
tree5a5b91ec5751d91d3ef7c819863d2b790acc6222 /lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
parent327a71e894bc7a903f367cdc014b60b6eb629854 (diff)
downloadsimplesamlphp-d89c8da19a62b0f578a489357c62daf42e2209cf.zip
simplesamlphp-d89c8da19a62b0f578a489357c62daf42e2209cf.tar.gz
simplesamlphp-d89c8da19a62b0f578a489357c62daf42e2209cf.tar.bz2
Adding support for CIDR based hinting. this means you can add a IP range to a remote saml 2 iudp, and that idp will show up as preferred to users within that ip range
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@349 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SimpleSAML/Metadata/MetaDataStorageHandler.php')
-rw-r--r--lib/SimpleSAML/Metadata/MetaDataStorageHandler.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
index 03074e5..555628b 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
@@ -214,7 +214,28 @@ class SimpleSAML_Metadata_MetaDataStorageHandler {
/* We were unable to find the hostname/path in any metadata source. */
throw new Exception('Could not find any default metadata entities in set [' . $set . '] for host [' . $currenthost . ' : ' . $currenthostwithpath . ']');
}
-
+
+ /**
+ * This method will call getPreferredEntityIdFromCIDRhint() on all of the
+ * sources.
+ *
+ * @param $set Which set of metadata we are looking it up in.
+ * @param $ip IP address
+ * @return The entity id of a entity which have a CIDR hint where the provided
+ * IP address match.
+ */
+ public function getPreferredEntityIdFromCIDRhint($set, $ip) {
+
+ foreach($this->sources as $source) {
+ $entityId = $source->getPreferredEntityIdFromCIDRhint($set, $ip);
+ if($entityId !== NULL) {
+ return $entityId;
+ }
+ }
+
+ return NULL;
+
+ }
/**
* This function looks up the metadata for the given entity id in the given set. It will throw an