ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Extensions.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
6 use SAML2\Utils;
7 use SAML2\XML\alg\Common as ALG;
10 use SAML2\XML\mdrpi\Common as MDRPI;
11 use SAML2\XML\mdui\Common as MDUI;
13 
20 {
27  public static function getList(\DOMElement $parent)
28  {
29  $ret = array();
30  $supported = array(
31  Scope::NS => array(
32  'Scope' => '\SAML2\XML\shibmd\Scope',
33  ),
34  EntityAttributes::NS => array(
35  'EntityAttributes' => '\SAML2\XML\mdattr\EntityAttributes',
36  ),
37  MDRPI::NS_MDRPI => array(
38  'RegistrationInfo' => '\SAML2\XML\mdrpi\RegistrationInfo',
39  'PublicationInfo' => '\SAML2\XML\mdrpi\PublicationInfo',
40  ),
41  MDUI::NS => array(
42  'UIInfo' => '\SAML2\XML\mdui\UIInfo',
43  'DiscoHints' => '\SAML2\XML\mdui\DiscoHints',
44  ),
45  ALG::NS => array(
46  'DigestMethod' => '\SAML2\XML\alg\DigestMethod',
47  'SigningMethod' => '\SAML2\XML\alg\SigningMethod',
48  ),
49  );
50 
51  foreach (Utils::xpQuery($parent, './saml_metadata:Extensions/*') as $node) {
52  if (array_key_exists($node->namespaceURI, $supported) &&
53  array_key_exists($node->localName, $supported[$node->namespaceURI])
54  ) {
55  $ret[] = new $supported[$node->namespaceURI][$node->localName]($node);
56  } else {
57  $ret[] = new Chunk($node);
58  }
59  }
60 
61  return $ret;
62  }
63 
70  public static function addList(\DOMElement $parent, array $extensions)
71  {
72  if (empty($extensions)) {
73  return;
74  }
75 
76  $extElement = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:Extensions');
77  $parent->appendChild($extElement);
78 
79  foreach ($extensions as $ext) {
80  $ext->toXML($extElement);
81  }
82  }
83 }
const NS
The namespace used for the EntityAttributes extension.
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:230
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
static addList(\DOMElement $parent, array $extensions)
Add a list of Extensions to the given element.
Definition: Extensions.php:70
$ret
Definition: parser.php:6
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.
Definition: Extensions.php:27
const NS
The namespace used for the Scope extension element.
Definition: Scope.php:18