ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Extensions.php
Go to the documentation of this file.
1<?php
2
3namespace SAML2\XML\md;
4
7use SAML2\XML\alg\Common as ALG;
10use SAML2\XML\mdrpi\Common as MDRPI;
11use 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}
An exception for terminatinating execution or to throw for unit testing.
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:225
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.
Definition: Extensions.php:27
static addList(\DOMElement $parent, array $extensions)
Add a list of Extensions to the given element.
Definition: Extensions.php:70
const NS
The namespace used for the EntityAttributes extension.
const NS
The namespace used for the Scope extension element.
Definition: Scope.php:18
$ret
Definition: parser.php:6