You are here

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

Constructor for SAML 2 response messages.

Parameters

DOMElement|NULL $xml The input message.:

File

includes/Response.php, line 42

Class

SAML2_Response
Class for SAML2 Response messages.

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);
    }
  }
}