SimpleSAML_XML_Shib13_AuthnResponse::setXML PHP Method

setXML() public method

public setXML ( $xml )
    public function setXML($xml)
    {
        assert('is_string($xml)');
        try {
            $this->dom = \SAML2\DOMDocumentFactory::fromString(str_replace("\r", "", $xml));
        } catch (\Exception $e) {
            throw new Exception('Unable to parse AuthnResponse XML.');
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Decode a received response.
  *
  * @param array $post  POST data received.
  * @return SimpleSAML_XML_Shib13_AuthnResponse  Response.
  */
 public function decodeResponse($post)
 {
     assert('is_array($post)');
     if (!array_key_exists('SAMLResponse', $post)) {
         throw new Exception('Missing required SAMLResponse parameter.');
     }
     $rawResponse = $post['SAMLResponse'];
     $samlResponseXML = base64_decode($rawResponse);
     SimpleSAML_Utilities::debugMessage($samlResponseXML, 'in');
     SimpleSAML_Utilities::validateXMLDocument($samlResponseXML, 'saml11');
     $samlResponse = new SimpleSAML_XML_Shib13_AuthnResponse();
     $samlResponse->setXML($samlResponseXML);
     if (array_key_exists('TARGET', $post)) {
         $samlResponse->setRelayState($post['TARGET']);
     }
     return $samlResponse;
 }
All Usage Examples Of SimpleSAML_XML_Shib13_AuthnResponse::setXML