You are here

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

Constructor for SAML 2 response messages.

Parameters

DOMElement|NULL $xml The input message.:

File

src/SAML2_Response.php, line 39

Class

SAML2_Response
Class for SAML2 Response messages.

Namespace

Drupal\miniorange_saml

Code

public function __construct(DOMElement $xml = NULL) {

  //parent::__construct('Response', $xml);
  $this->assertions = array();
  $this->certificates = array();
  if ($xml === NULL) {
    return;
  }
  $sig = Utilities::validateElement($xml);
  if ($sig !== FALSE) {
    $this->certificates = $sig['Certificates'];
    $this->signatureData = $sig;
  }

  /* set the destination from saml response */
  if ($xml
    ->hasAttribute('Destination')) {
    $this->destination = $xml
      ->getAttribute('Destination');
  }
  for ($node = $xml->firstChild; $node !== NULL; $node = $node->nextSibling) {
    if ($node->namespaceURI !== 'urn:oasis:names:tc:SAML:2.0:assertion') {
      continue;
    }
    if ($node->localName === 'Assertion' || $node->localName === 'EncryptedAssertion') {
      $this->assertions[] = new SAML2_Assertion($node);
    }
  }
}