From aa97df41bd22f5b3f13b8371ad57e99d263fd706 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 4 Jun 2008 07:30:33 +0000
Subject: [PATCH] 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
---
 lib/SimpleSAML/XML/Validator.php | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/lib/SimpleSAML/XML/Validator.php b/lib/SimpleSAML/XML/Validator.php
index f1dedd908..16f75d0b7 100644
--- a/lib/SimpleSAML/XML/Validator.php
+++ b/lib/SimpleSAML/XML/Validator.php
@@ -11,11 +11,6 @@ require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'xmlsecli
  */
 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
 	 * was signed with.
@@ -31,14 +26,12 @@ class SimpleSAML_XML_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
 	 *                      NULL (the default), then we will use whatever is the default ID.
 	 */
-	public function __construct($xmlDocument, $idAttribute = NULL, $publickey = FALSE) {
-		assert('$xmlDocument instanceof DOMDocument');
-
-		$this->xmlDocument = $xmlDocument;
+	public function __construct($xmlNode, $idAttribute = NULL, $publickey = FALSE) {
+		assert('$xmlNode instanceof DOMNode');
 
 		/* Create an XML security object. */
 		$objXMLSecDSig = new XMLSecurityDSig();
@@ -50,7 +43,7 @@ class SimpleSAML_XML_Validator {
 		}
 
 		/* Locate the XMLDSig Signature element to be used. */
-		$signatureElement = $objXMLSecDSig->locateSignature($this->xmlDocument);
+		$signatureElement = $objXMLSecDSig->locateSignature($xmlNode);
 		if (!$signatureElement) {
 			throw new Exception('Could not locate XML Signature element.');
 		}
-- 
GitLab