You are here

public function XMLSecurityDSig::validateReference in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

Return value

bool

Throws

Exception

File

src/XMLSecurityKey.php, line 1249

Class

XMLSecurityDSig

Namespace

Drupal\miniorange_saml

Code

public function validateReference() {
  $docElem = $this->sigNode->ownerDocument->documentElement;
  if (!$docElem
    ->isSameNode($this->sigNode)) {
    if ($this->sigNode->parentNode != null) {
      $this->sigNode->parentNode
        ->removeChild($this->sigNode);
    }
  }
  $xpath = $this
    ->getXPathObj();
  $query = "./secdsig:SignedInfo/secdsig:Reference";
  $nodeset = $xpath
    ->query($query, $this->sigNode);
  if ($nodeset->length == 0) {
    throw new Exception("Reference nodes not found");
  }

  /* Initialize/reset the list of validated nodes. */
  $this->validatedNodes = array();
  foreach ($nodeset as $refNode) {
    if (!$this
      ->processRefNode($refNode)) {

      /* Clear the list of validated nodes. */
      $this->validatedNodes = null;
      throw new Exception("Reference validation failed");
    }
  }
  return true;
}