Skip to content

Commit a15ece1

Browse files
committed
Overload getXPathObj
1 parent f4b1e7c commit a15ece1

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/XMLSecurityDSig.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace SimpleSAML\XMLSecurity;
44

5+
use DOMXPath;
6+
57
/**
68
* xmlseclibs.php
79
*
@@ -43,6 +45,10 @@
4345

4446
class XMLSecurityDSig extends \RobRichards\XMLSecLibs\XMLSecurityDSig
4547
{
48+
/** @var string */
49+
private $prefix = '';
50+
51+
4652
/**
4753
* @return bool
4854
* @throws Exception
@@ -77,4 +83,29 @@ public function validateReference()
7783
}
7884
return true;
7985
}
86+
87+
88+
/**
89+
* Returns the XPathObj or null if xPathCtx is set and sigNode is empty.
90+
*
91+
* @return DOMXPath|null
92+
*/
93+
private function getXPathObj()
94+
{
95+
if (empty($this->xPathCtx) && ! empty($this->sigNode)) {
96+
$xpath = new DOMXPath($this->sigNode->ownerDocument);
97+
$xpath->registerNamespace('secdsig', self::XMLDSIGNS);
98+
$this->xPathCtx = $xpath;
99+
}
100+
return $this->xPathCtx;
101+
}
102+
103+
104+
/**
105+
* Reset the XPathObj to null
106+
*/
107+
private function resetXPathObj()
108+
{
109+
$this->xPathCtx = null;
110+
}
80111
}

0 commit comments

Comments
 (0)