Skip to content
Snippets Groups Projects
Unverified Commit 854c2127 authored by m0ark's avatar m0ark Committed by GitHub
Browse files

Update MetaDataStorageSource.php

Support both hint.cidr and DiscoHints->IPHint
parent 77d72b5b
No related branches found
No related tags found
No related merge requests found
......@@ -177,18 +177,27 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource
$metadataSet = $this->getMetadataSet($set);
foreach ($metadataSet as $index => $entry) {
if (!array_key_exists('DiscoHints', $entry)) {
continue;
$cidrHints = array();
// support hint.cidr for idp discovery
if (array_key_exists('hint.cidr', $entry) && is_array($entry['hint.cidr'])) {
$cidrHints = $entry['hint.cidr'];
}
if (!array_key_exists('IPHint', $entry['DiscoHints'])) {
continue;
// support discohints in idp metadata for idp discovery
if (array_key_exists('DiscoHints', $entry)
&& array_key_exists('IPHint', $entry['DiscoHints'])
&& is_array($entry['DiscoHints']['IPHint'])) {
// merge with hints derived from discohints, but prioritize hint.cidr in case it is used
$cidrHints = array_merge($entry['DiscoHints']['IPHint'], $cidrHints);
}
if (!is_array($entry['DiscoHints']['IPHint'])) {
if (empty($cidrHints)) {
continue;
}
foreach ($entry['DiscoHints']['IPHint'] as $hint_entry) {
foreach ($cidrHints as $hint_entry) {
if (SimpleSAML\Utils\Net::ipCIDRcheck($hint_entry, $ip)) {
if ($type === 'entityid') {
return $entry['entityid'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment