-
Notifications
You must be signed in to change notification settings - Fork 135
/
XPath.php
36 lines (31 loc) · 976 Bytes
/
XPath.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace SimpleSAML\SAML2\Utils;
use DOMNode;
use DOMXPath;
use SimpleSAML\SAML2\Constants as C;
/**
* Compilation of utilities for XPath.
*
* @package simplesamlphp/saml2
*/
class XPath extends \SimpleSAML\XMLSecurity\Utils\XPath
{
/**
* Get a DOMXPath object that can be used to search for SAML elements.
*
* @param \DOMNode $node The document to associate to the DOMXPath object.
*
* @return \DOMXPath A DOMXPath object ready to use in the given document, with several
* saml-related namespaces already registered.
*/
public static function getXPath(DOMNode $node): DOMXPath
{
$xp = parent::getXPath($node);
$xp->registerNamespace('soap-env', C::NS_SOAP);
$xp->registerNamespace('saml_protocol', C::NS_SAMLP);
$xp->registerNamespace('saml_assertion', C::NS_SAML);
$xp->registerNamespace('saml_metadata', C::NS_MD);
return $xp;
}
}