Skip to content
Snippets Groups Projects
Commit aa97df41 authored by Olav Morken's avatar Olav Morken
Browse files

XML/Validator: Add support for validating nodes which are a child node in the DOMDocument.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@596 44740490-163a-0410-bde0-09ae8108e29a
parent ec58b540
No related branches found
No related tags found
No related merge requests found
...@@ -11,11 +11,6 @@ require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'xmlsecli ...@@ -11,11 +11,6 @@ require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'xmlsecli
*/ */
class SimpleSAML_XML_Validator { class SimpleSAML_XML_Validator {
/**
* This variable contains the XML document we have validated.
*/
private $xmlDocument;
/** /**
* This variable contains the fingerprint of the certificate the XML document * This variable contains the fingerprint of the certificate the XML document
* was signed with. * was signed with.
...@@ -31,14 +26,12 @@ class SimpleSAML_XML_Validator { ...@@ -31,14 +26,12 @@ class SimpleSAML_XML_Validator {
/** /**
* This function initializes the validator. * This function initializes the validator.
* *
* @param $xmlDocument The XML document we should validate. * @param $xmlNode The XML node which contains the Signature element.
* @param $idAttribute The ID attribute which is used in node references. If this attribute is * @param $idAttribute The ID attribute which is used in node references. If this attribute is
* NULL (the default), then we will use whatever is the default ID. * NULL (the default), then we will use whatever is the default ID.
*/ */
public function __construct($xmlDocument, $idAttribute = NULL, $publickey = FALSE) { public function __construct($xmlNode, $idAttribute = NULL, $publickey = FALSE) {
assert('$xmlDocument instanceof DOMDocument'); assert('$xmlNode instanceof DOMNode');
$this->xmlDocument = $xmlDocument;
/* Create an XML security object. */ /* Create an XML security object. */
$objXMLSecDSig = new XMLSecurityDSig(); $objXMLSecDSig = new XMLSecurityDSig();
...@@ -50,7 +43,7 @@ class SimpleSAML_XML_Validator { ...@@ -50,7 +43,7 @@ class SimpleSAML_XML_Validator {
} }
/* Locate the XMLDSig Signature element to be used. */ /* Locate the XMLDSig Signature element to be used. */
$signatureElement = $objXMLSecDSig->locateSignature($this->xmlDocument); $signatureElement = $objXMLSecDSig->locateSignature($xmlNode);
if (!$signatureElement) { if (!$signatureElement) {
throw new Exception('Could not locate XML Signature element.'); throw new Exception('Could not locate XML Signature element.');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment