You are here

class SAML2_Response in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

Class for SAML2 Response messages.

Hierarchy

Expanded class hierarchy of SAML2_Response

File

includes/Response.php, line 24

View source
class SAML2_Response {

  /**
   * The assertions in this response.
   */
  private $assertions;

  /**
   * The destination URL in this response.
   */
  private $destination;
  private $certificates;
  private $signatureData;

  /**
   * Constructor for SAML 2 response messages.
   *
   * @param DOMElement|NULL $xml The input message.
   */
  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);
      }
    }
  }

  /**
   * Retrieve the assertions in this response.
   *
   * @return SAML2_Assertion[]|SAML2_EncryptedAssertion[]
   */
  public function getAssertions() {
    return $this->assertions;
  }

  /**
   * Set the assertions that should be included in this response.
   *
   * @param SAML2_Assertion[]|SAML2_EncryptedAssertion[] The assertions.
   */
  public function setAssertions(array $assertions) {
    $this->assertions = $assertions;
  }
  public function getDestination() {
    return $this->destination;
  }
  public function getCertificates() {
    return $this->certificates;
  }
  public function getSignatureData() {
    return $this->signatureData;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SAML2_Response::$assertions private property The assertions in this response.
SAML2_Response::$certificates private property
SAML2_Response::$destination private property The destination URL in this response.
SAML2_Response::$signatureData private property
SAML2_Response::getAssertions public function Retrieve the assertions in this response.
SAML2_Response::getCertificates public function
SAML2_Response::getDestination public function
SAML2_Response::getSignatureData public function
SAML2_Response::setAssertions public function Set the assertions that should be included in this response.
SAML2_Response::__construct public function Constructor for SAML 2 response messages.