ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
MetaDataStorageHandlerXML.php
Go to the documentation of this file.
1<?php
2
3
12{
13
19 private $metadata;
20
21
33 protected function __construct($config)
34 {
35 $src = $srcXml = null;
36 if (array_key_exists('file', $config)) {
37 // get the configuration
39 $src = $globalConfig->resolvePath($config['file']);
40 } elseif (array_key_exists('url', $config)) {
41 $src = $config['url'];
42 } elseif (array_key_exists('xml', $config)) {
43 $srcXml = $config['xml'];
44 } else {
45 throw new Exception("Missing one of 'file', 'url' and 'xml' in XML metadata source configuration.");
46 }
47
48
49 $SP1x = array();
50 $IdP1x = array();
51 $SP20 = array();
52 $IdP20 = array();
53 $AAD = array();
54
55 if(isset($src)) {
57 } elseif(isset($srcXml)) {
59 } else {
60 throw new Exception("Neither source file path/URI nor string data provided");
61 }
62 foreach ($entities as $entityId => $entity) {
63 $md = $entity->getMetadata1xSP();
64 if ($md !== null) {
65 $SP1x[$entityId] = $md;
66 }
67
68 $md = $entity->getMetadata1xIdP();
69 if ($md !== null) {
70 $IdP1x[$entityId] = $md;
71 }
72
73 $md = $entity->getMetadata20SP();
74 if ($md !== null) {
75 $SP20[$entityId] = $md;
76 }
77
78 $md = $entity->getMetadata20IdP();
79 if ($md !== null) {
80 $IdP20[$entityId] = $md;
81 }
82
83 $md = $entity->getAttributeAuthorities();
84 if (count($md) > 0) {
85 $AAD[$entityId] = $md[0];
86 }
87 }
88
89 $this->metadata = array(
90 'shib13-sp-remote' => $SP1x,
91 'shib13-idp-remote' => $IdP1x,
92 'saml20-sp-remote' => $SP20,
93 'saml20-idp-remote' => $IdP20,
94 'attributeauthority-remote' => $AAD,
95 );
96 }
97
98
107 public function getMetadataSet($set)
108 {
109 if (array_key_exists($set, $this->metadata)) {
110 return $this->metadata[$set];
111 }
112
113 // we don't have this metadata set
114 return array();
115 }
116}
An exception for terminatinating execution or to throw for unit testing.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
getMetadataSet($set)
This function returns an associative array with metadata for all entities in the given set.
__construct($config)
This function initializes the XML metadata source.
static parseDescriptorsString($string)
This function parses a string with XML data.
Definition: SAMLParser.php:318
static parseDescriptorsFile($file)
This function parses a file where the root node is either an EntityDescriptor element or an EntitiesD...
Definition: SAMLParser.php:285
$config
Definition: bootstrap.php:15
if( $source===null) if(!($source instanceof sspmod_saml_Auth_Source_SP)) $entityId
Definition: metadata.php:22
$globalConfig