コード例 #1
0
ファイル: HttpPost.php プロジェクト: LearnerNation/lightsaml
 /**
  * @param Message $message
  * @return PostResponse
  */
 function send(Message $message)
 {
     $destination = $message->getDestination() ?: $this->getDestination();
     $context = new SerializationContext();
     $message->getSignedXml($context->getDocument(), $context);
     $msgStr = $context->getDocument()->saveXML();
     $this->dispatchSend($msgStr);
     $msgStr = base64_encode($msgStr);
     $type = $message instanceof AbstractRequest ? 'SAMLRequest' : 'SAMLResponse';
     $data = array($type => $msgStr);
     if ($message->getRelayState()) {
         $data['RelayState'] = $message->getRelayState();
     }
     $result = new PostResponse($destination, $data);
     return $result;
 }
コード例 #2
0
 /**
  * @param string $msg
  * @param Message $message
  * @return string
  */
 private function getDestinationUrl($msg, Message $message)
 {
     $destination = $message->getDestination() ?: $this->getDestination();
     if (strpos($destination, '?') === FALSE) {
         $destination .= '?' . $msg;
     } else {
         $destination .= '&' . $msg;
     }
     return $destination;
 }