You are here

public static function Utilities::xpQuery in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

17 calls to Utilities::xpQuery()
IdentityProviders::parseEncryptionCertificate in src/MetadataReader.php
IdentityProviders::parseInfo in src/MetadataReader.php
IdentityProviders::parseSigningCertificate in src/MetadataReader.php
IdentityProviders::parseSLOService in src/MetadataReader.php
IdentityProviders::parseSSOService in src/MetadataReader.php

... See full list

File

src/Utilities.php, line 288

Class

Utilities
This file is part of miniOrange SAML plugin.

Namespace

Drupal\miniorange_saml

Code

public static function xpQuery(DOMNode $node, $query) {
  static $xpCache = NULL;
  if ($node->ownerDocument == null) {
    $doc = $node;
  }
  else {
    $doc = $node->ownerDocument;
  }
  if ($xpCache === NULL || !$xpCache->document
    ->isSameNode($doc)) {
    $xpCache = new DOMXPath($doc);
    $xpCache
      ->registerNamespace('soap-env', 'http://schemas.xmlsoap.org/soap/envelope/');
    $xpCache
      ->registerNamespace('saml_protocol', 'urn:oasis:names:tc:SAML:2.0:protocol');
    $xpCache
      ->registerNamespace('saml_assertion', 'urn:oasis:names:tc:SAML:2.0:assertion');
    $xpCache
      ->registerNamespace('saml_metadata', 'urn:oasis:names:tc:SAML:2.0:metadata');
    $xpCache
      ->registerNamespace('ds', 'http://www.w3.org/2000/09/xmldsig#');
    $xpCache
      ->registerNamespace('xenc', 'http://www.w3.org/2001/04/xmlenc#');
  }
  $results = $xpCache
    ->query($query, $node);
  $ret = array();
  for ($i = 0; $i < $results->length; $i++) {
    $ret[$i] = $results
      ->item($i);
  }
  return $ret;
}