summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php
diff options
context:
space:
mode:
authorAndreas Åkre Solberg <andreas.solberg@uninett.no>2008-01-08 11:13:23 +0000
committerAndreas Åkre Solberg <andreas.solberg@uninett.no>2008-01-08 11:13:23 +0000
commit608a9b2ccab3f11b9ba2e72f24b38bdbb7047bc4 (patch)
tree1af05323a9c70831e56a2b6e46d7d02597c209c0 /lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php
parent681a8c13c4c9892b808cdc40f7bb522c6b2cb77f (diff)
downloadsimplesamlphp-608a9b2ccab3f11b9ba2e72f24b38bdbb7047bc4.zip
simplesamlphp-608a9b2ccab3f11b9ba2e72f24b38bdbb7047bc4.tar.gz
simplesamlphp-608a9b2ccab3f11b9ba2e72f24b38bdbb7047bc4.tar.bz2
Changed classes that access metadata to use the new API. Also added some initial code to start parsing Shibboleth 1.3 IdP metadata.. will do more on this tomorrow.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@147 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php')
-rw-r--r--lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php56
1 files changed, 49 insertions, 7 deletions
diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php
index 64954a3..c62c5e9 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php
@@ -16,7 +16,7 @@ require_once('SimpleSAML/Metadata/MetaDataStorageHandler.php');
/**
* Configuration of SimpleSAMLphp
*/
-class MetaDataStorageHandlerSAML2Meta extends SimpleSAML_Metadata_MetaDataStorageHandler {
+class SimpleSAML_Metadata_MetaDataStorageHandlerSAML2Meta extends SimpleSAML_Metadata_MetaDataStorageHandler {
@@ -28,7 +28,6 @@ class MetaDataStorageHandlerSAML2Meta extends SimpleSAML_Metadata_MetaDataStorag
}
-
public function load($set) {
$metadata = null;
if (!in_array($set, array(
@@ -43,13 +42,56 @@ class MetaDataStorageHandlerSAML2Meta extends SimpleSAML_Metadata_MetaDataStorag
assert($config instanceof SimpleSAML_Configuration);
$metadatasetfile = $config->getBaseDir() . '/' .
- $config->getValue('metadatadir') . '/' . $set . '/' . $file . '.php';
+ $config->getValue('metadatadir') . '/xml/' . $set . '.xml';
+
+
+ if (!file_exists($metadatasetfile)) throw new Exception('Could not find SAML 2.0 Metadata file :'. $metadatasetfile);
+
+ #$metadata = file_get_contents($metadatasetfile);
+
+ // for now testing with the shib aai metadata...
+ $metadata = file_get_contents("http://www.switch.ch/aai/federation/SWITCHaai/metadata.switchaai_signed.xml");
+ echo '<pre>';
+
+ $simplexml_metadata = new SimpleXMLElement($metadata);
+ $simplexml_metadata->registerXPathNamespace('saml2meta', 'urn:oasis:names:tc:SAML:2.0:metadata');
+ $idpentities = $simplexml_metadata->xpath('/saml2meta:EntitiesDescriptor/saml2meta:EntityDescriptor[./saml2meta:IDPSSODescriptor]');
- if (!file_exists($metadatasetfile)) {
- throw new Exception('Could not open file: ' . $metadatasetfile);
+ if (!$idpentities) throw new Exception('Could not find any entity descriptors in the meta data file: ' . $metadatasetfile);
+ foreach ($idpentities as $idpentity) {
+ echo 'Entity: ' . $idpentity['entityID'][0] . "\n";
+
+ $newmeta = array('entityid' => (string) $idpentity['entityID']);
+
+ #$idpentity['xmlns'] = 'urn:oasis:names:tc:SAML:2.0:metadata';
+
+ $namespaces = $idpentity->getNamespaces();
+
+ foreach ($namespaces AS $prefix => $ns) {
+ $newmeta[($prefix === '') ? 'xmlns' : 'xmlns:' . $prefix)] = $ns;
+ }
+
+ $simplexml_metadata_entry = new SimpleXMLElement($idpentity->asXML());
+ $simplexml_metadata_entry->registerXPathNamespace('saml2meta', 'urn:oasis:names:tc:SAML:2.0:metadata');
+
+
+ $entry = $simplexml_metadata_entry->xpath("/saml2meta:EntityDescriptor/saml2meta:IDPSSODescriptor/saml2meta:SingleSignOnService[@Binding='urn:mace:shibboleth:1.0:profiles:AuthnRequest']/@Location");
+
+ $newmeta['SingleSignOnService'] = (string)$entry[0]['Location'];
+
+ echo 'Entry: ';
+ print_r($newmeta);
+
}
- include($metadatasetfile);
+
+
+ //echo htmlentities($metadata);
+ echo '</pre>';
+ exit();
+
+
+
if (!is_array($metadata)) {
throw new Exception('Could not load metadata set [' . $set . '] from file: ' . $metadatasetfile);
@@ -65,7 +107,7 @@ class MetaDataStorageHandlerSAML2Meta extends SimpleSAML_Metadata_MetaDataStorag
}
}
-
+
public function getMetaData($entityid = null, $set = 'saml20-sp-hosted') {
if (!isset($entityid)) {