/** * @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; }
/** * @param string $msg * @param Message $message */ private function addRelayStateToUrl(&$msg, Message $message) { if ($message->getRelayState() !== null) { $msg .= '&RelayState=' . urlencode($message->getRelayState()); } }