ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  // get the configuration
37 
38  if (array_key_exists('file', $config)) {
39  $src = $globalConfig->resolvePath($config['file']);
40  } elseif (array_key_exists('url', $config)) {
41  $src = $config['url'];
42  } else {
43  throw new Exception("Missing either 'file' or 'url' in XML metadata source configuration.");
44  }
45 
46 
47  $SP1x = array();
48  $IdP1x = array();
49  $SP20 = array();
50  $IdP20 = array();
51  $AAD = array();
52 
54  foreach ($entities as $entityId => $entity) {
55 
56  $md = $entity->getMetadata1xSP();
57  if ($md !== null) {
58  $SP1x[$entityId] = $md;
59  }
60 
61  $md = $entity->getMetadata1xIdP();
62  if ($md !== null) {
63  $IdP1x[$entityId] = $md;
64  }
65 
66  $md = $entity->getMetadata20SP();
67  if ($md !== null) {
68  $SP20[$entityId] = $md;
69  }
70 
71  $md = $entity->getMetadata20IdP();
72  if ($md !== null) {
73  $IdP20[$entityId] = $md;
74  }
75 
76  $md = $entity->getAttributeAuthorities();
77  if (count($md) > 0) {
78  $AAD[$entityId] = $md[0];
79  }
80  }
81 
82  $this->metadata = array(
83  'shib13-sp-remote' => $SP1x,
84  'shib13-idp-remote' => $IdP1x,
85  'saml20-sp-remote' => $SP20,
86  'saml20-idp-remote' => $IdP20,
87  'attributeauthority-remote' => $AAD,
88  );
89  }
90 
91 
100  public function getMetadataSet($set)
101  {
102  if (array_key_exists($set, $this->metadata)) {
103  return $this->metadata[$set];
104  }
105 
106  // we don't have this metadata set
107  return array();
108  }
109 }
static parseDescriptorsFile($file)
This function parses a file where the root node is either an EntityDescriptor element or an EntitiesD...
Definition: SAMLParser.php:302
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.
Create styles array
The data for the language used.
if($source===null) if(!($source instanceof sspmod_saml_Auth_Source_SP)) $entityId
Definition: metadata.php:22
$globalConfig
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.