ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SimpleSAML_Metadata_MetaDataStorageHandlerXML Class Reference
+ Inheritance diagram for SimpleSAML_Metadata_MetaDataStorageHandlerXML:
+ Collaboration diagram for SimpleSAML_Metadata_MetaDataStorageHandlerXML:

Public Member Functions

 getMetadataSet ($set)
 This function returns an associative array with metadata for all entities in the given set. More...
 

Protected Member Functions

 __construct ($config)
 This function initializes the XML metadata source. More...
 

Private Attributes

 $metadata
 

Additional Inherited Members

Detailed Description

Definition at line 11 of file MetaDataStorageHandlerXML.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleSAML_Metadata_MetaDataStorageHandlerXML::__construct (   $config)
protected

This function initializes the XML metadata source.

The configuration must contain one of the following options:

  • 'file': Path to a file with the metadata. This path is relative to the SimpleSAMLphp base directory.
  • 'url': URL we should download the metadata from. This is only meant for testing.
Parameters
array$configThe configuration for this instance of the XML metadata source.
Exceptions
ExceptionIf neither the 'file' or 'url' options are defined in the configuration.

Definition at line 33 of file MetaDataStorageHandlerXML.php.

References $config, $entityId, $globalConfig, SimpleSAML_Configuration\getInstance(), SimpleSAML_Metadata_SAMLParser\parseDescriptorsFile(), and SimpleSAML_Metadata_SAMLParser\parseDescriptorsString().

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  }
$config
Definition: bootstrap.php:15
static parseDescriptorsFile($file)
This function parses a file where the root node is either an EntityDescriptor element or an EntitiesD...
Definition: SAMLParser.php:285
static parseDescriptorsString($string)
This function parses a string with XML data.
Definition: SAMLParser.php:318
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.
+ Here is the call graph for this function:

Member Function Documentation

◆ getMetadataSet()

SimpleSAML_Metadata_MetaDataStorageHandlerXML::getMetadataSet (   $set)

This function returns an associative array with metadata for all entities in the given set.

The key of the array is the entity id.

Parameters
string$setThe set we want to list metadata for.
Returns
array An associative array with all entities in the given set.

Definition at line 107 of file MetaDataStorageHandlerXML.php.

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  }

Field Documentation

◆ $metadata

SimpleSAML_Metadata_MetaDataStorageHandlerXML::$metadata
private

Definition at line 19 of file MetaDataStorageHandlerXML.php.


The documentation for this class was generated from the following file: