Exemplo n.º 1
0
 /**
  * @param Request $request
  * @return Message
  * @throws \AerialShip\LightSaml\Error\BindingException
  */
 function receive(Request $request)
 {
     $post = $request->getPost();
     if (array_key_exists('SAMLRequest', $post)) {
         $msg = $post['SAMLRequest'];
     } elseif (array_key_exists('SAMLResponse', $post)) {
         $msg = $post['SAMLResponse'];
     } else {
         throw new BindingException('Missing SAMLRequest or SAMLResponse parameter');
     }
     $msg = base64_decode($msg);
     $this->dispatchReceive($msg);
     $doc = new \DOMDocument();
     $doc->loadXML($msg);
     $result = Message::fromXML($doc->firstChild);
     if (array_key_exists('RelayState', $post)) {
         $result->setRelayState($post['RelayState']);
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @param string $msg
  * @return Message
  */
 private function loadMessageFromXml($msg)
 {
     $doc = new \DOMDocument();
     $doc->loadXML($msg);
     $message = Message::fromXML($doc->firstChild);
     return $message;
 }