diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index ee769e5a43337e32cfbda968df7be354481c321e..5980312a07a06df209a1c2796f982736a2249b84 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -81,22 +81,10 @@ class SimpleSAML_Bindings_Shib13_HTTPPost { SimpleSAML_Utilities::debugMessage($response, 'out'); - if ($this->configuration->getBoolean('debug', FALSE)) { - $p = new SimpleSAML_XHTML_Template($this->configuration, 'post-debug.php'); - $p->data['header'] = 'SAML (Shibboleth 1.3) Response Debug-mode'; - $p->data['RelayStateName'] = 'TARGET'; - $p->data['RelayState'] = $relayState; - $p->data['destination'] = $shire; - $p->data['response'] = str_replace("\n", "", base64_encode($response)); - $p->data['responseHTML'] = htmlspecialchars(SimpleSAML_Utilities::formatXMLString($response)); - $p->show(); - - } else { - SimpleSAML_Utilities::postRedirect($shire, array( - 'TARGET' => $relayState, - 'SAMLResponse' => base64_encode($response), - )); - } + SimpleSAML_Utilities::postRedirect($shire, array( + 'TARGET' => $relayState, + 'SAMLResponse' => base64_encode($response), + )); } diff --git a/modules/exampleattributeserver/www/attributeserver.php b/modules/exampleattributeserver/www/attributeserver.php index 5099e7befc6c37ae9ac56cf4056ca34201fc326e..abce3e17ea8d72da2d331ce0a2046c2cd3429b82 100644 --- a/modules/exampleattributeserver/www/attributeserver.php +++ b/modules/exampleattributeserver/www/attributeserver.php @@ -83,5 +83,4 @@ $response->setAssertions(array($assertion)); sspmod_saml_Message::addSign($idpMetadata, $spMetadata, $response); $binding = new SAML2_HTTPPost(); -$binding->setDestination(sspmod_saml_Message::getDebugDestination()); $binding->send($response); diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php index 7ff0fa96bc560f64af212e8fd78f532209ebfc8d..9d9aeb40283be95d17b0e3b1698dd98c88aae52b 100644 --- a/modules/saml/lib/Auth/Source/SP.php +++ b/modules/saml/lib/Auth/Source/SP.php @@ -242,7 +242,6 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { SimpleSAML_Logger::debug('Sending SAML 2 AuthnRequest to ' . var_export($idpMetadata->getString('entityid'), TRUE)); $b = new SAML2_HTTPRedirect(); - $b->setDestination(sspmod_saml_Message::getDebugDestination()); $b->send($ar); assert('FALSE'); @@ -372,7 +371,6 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { $lr->setRelayState($id); $b = new SAML2_HTTPRedirect(); - $b->setDestination(sspmod_saml_Message::getDebugDestination()); $b->send($lr); assert('FALSE'); diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php index 00686c28ab3ce98d49b51931fb8c51d1b9895188..a4a7266008e3463c60786227dac63eb470092f4c 100644 --- a/modules/saml/lib/IdP/SAML2.php +++ b/modules/saml/lib/IdP/SAML2.php @@ -67,7 +67,6 @@ class sspmod_saml_IdP_SAML2 { /* Send the response. */ $binding = SAML2_Binding::getBinding($protocolBinding); - $binding->setDestination(sspmod_saml_Message::getDebugDestination()); $binding->send($ar); } @@ -114,7 +113,6 @@ class sspmod_saml_IdP_SAML2 { )); $binding = SAML2_Binding::getBinding($protocolBinding); - $binding->setDestination(sspmod_saml_Message::getDebugDestination()); $binding->send($ar); } @@ -323,7 +321,6 @@ class sspmod_saml_IdP_SAML2 { } $binding = new SAML2_HTTPRedirect(); - $binding->setDestination(sspmod_saml_Message::getDebugDestination()); $binding->send($lr); } diff --git a/modules/saml/lib/Message.php b/modules/saml/lib/Message.php index 6bb227e78a0733dc4423eb141843d710762420e4..e00bce2af67f37688e712a16f03989f727a5305e 100644 --- a/modules/saml/lib/Message.php +++ b/modules/saml/lib/Message.php @@ -10,26 +10,6 @@ */ class sspmod_saml_Message { - /** - * Retrieve the destination we should send the message to. - * - * This will return a debug endpoint if we have debug enabled. If debug - * is disabled, NULL is returned, in which case the default destination - * will be used. - * - * @return string|NULL The destination the message should be delivered to. - */ - public static function getDebugDestination() { - - $globalConfig = SimpleSAML_Configuration::getInstance(); - if (!$globalConfig->getBoolean('debug', FALSE)) { - return NULL; - } - - return SimpleSAML_Module::getModuleURL('saml/debug.php'); - } - - /** * Add signature key and and senders certificate to an element (Message or Assertion). * diff --git a/modules/saml/www/debug.php b/modules/saml/www/debug.php deleted file mode 100644 index ad86d18cffc1e9387b01a18b63d06793d9d9c611..0000000000000000000000000000000000000000 --- a/modules/saml/www/debug.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -/** - * Endpoint for debugging sent SAML-messages. - * - * This endpoint will display the message to the user before passing it - * to its destination. - * - * @package simpleSAMLphp - * @version $Id$ - */ - -SimpleSAML_Session::useTransientSession(); - -$globalConfig = SimpleSAML_Configuration::getInstance(); - -if (array_key_exists('SAMLRequest', $_REQUEST)) { - $type = 'SAMLRequest'; -} elseif (array_key_exists('SAMLResponse', $_REQUEST)) { - $type = 'SAMLResponse'; -} else { - throw new SimpleSAML_Error_BadRequest('Unknown SAML2 message type.'); -} - -$message = $_REQUEST[$type]; - -$message = @base64_decode($message); -if ($message === FALSE) { - throw new SimpleSAML_Error_BadRequest('Unable to base64-decode message.'); -} - -if ($_SERVER['REQUEST_METHOD'] === 'GET') { - $message = @gzinflate($message); - if ($message === FALSE) { - throw new SimpleSAML_Error_BadRequest('Unable to gzinflate message.'); - } -} - -$document = new DOMDocument(); -if (!$document->loadXML($message)) { - throw new SimpleSAML_Error_BadRequest('Unable to parse XML.'); -} -$root = $document->firstChild; - -if (!$root->hasAttribute('Destination')) { - throw new SimpleSAML_Error_BadRequest('Missing Destination-attribute on root element.'); -} -$realDestination = $root->getAttribute('Destination'); - -SimpleSAML_Utilities::formatDOMElement($root); -$message = $document->saveXML($root); - - -switch($_SERVER['REQUEST_METHOD']) { -case 'GET': - $queryString = $_SERVER['QUERY_STRING']; - - if (strpos($realDestination, '?') === FALSE) { - $url = $realDestination . '?' . $queryString; - } else { - $url = $realDestination . '&' . $queryString; - } - - $t = new SimpleSAML_XHTML_Template($globalConfig, 'httpredirect-debug.php'); - $t->data['url'] = $url; - $t->data['message'] = htmlspecialchars($message); - $t->show(); - exit(); - -case 'POST': - $post = $_POST; - - $t = new SimpleSAML_XHTML_Template($globalConfig, 'post-debug.php'); - - $t->data['post'] = $post; - $t->data['destination'] = $realDestination; - $t->data['responseHTML'] = htmlspecialchars($message); - $t->show(); - exit(); - -default: - throw new SimpleSAML_Error_BadRequest('Unexpected request method: ' . var_export($_SERVER['REQUEST_METHOD'], TRUE)); -} - -?> \ No newline at end of file diff --git a/templates/httpredirect-debug.php b/templates/httpredirect-debug.php deleted file mode 100644 index 62fa382c6e7b31b02defd4d7bf453acff319fa47..0000000000000000000000000000000000000000 --- a/templates/httpredirect-debug.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - $this->data['autofocus'] = 'sendlink'; - $this->includeAtTemplateBase('includes/header.php'); -?> - - <h2><?php echo($this->t('{admin:debug_sending_message_title}')); ?></h2> - - <p><?php echo($this->t('{admin:debug_sending_message_text_link}')); ?></p> - - <p>[ <a id="sendlink" href="<?php echo htmlspecialchars($this->data['url']); ?>"><?php echo($this->t('{admin:debug_sending_message_send}')); ?></a> ]</p> - - <h2><?php echo($this->t('{admin:debug_sending_message_msg_title}')); ?></h2> - - <p><?php echo($this->t('{admin:debug_sending_message_msg_text}')); ?></p> - - <pre style="overflow: scroll; border: 1px solid #eee"><?php echo $this->data['message']; ?></pre> - - <p><?php echo($this->t('{admin:debug_disable_debug_mode}')); ?></p> - -<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/templates/post-debug.php b/templates/post-debug.php deleted file mode 100644 index fabf353b3e00d8f245ad4c59d5978f1c75c16fd9..0000000000000000000000000000000000000000 --- a/templates/post-debug.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - $this->data['autofocus'] = 'sendbutton'; - $this->includeAtTemplateBase('includes/header.php'); - -if (array_key_exists('post', $this->data)) { - $post = $this->data['post']; -} else { - /* For backwards compatibility. */ - assert('array_key_exists("response", $this->data)'); - assert('array_key_exists("RelayStateName", $this->data)'); - assert('array_key_exists("RelayState", $this->data)'); - - $post = array( - 'SAMLResponse' => $this->data['response'], - $this->data['RelayStateName'] => $this->data['RelayState'], - ); -} - -/** - * Write out one or more INPUT elements for the given name-value pair. - * - * If the value is a string, this function will write a single INPUT element. - * If the value is an array, it will write multiple INPUT elements to - * recreate the array. - * - * @param string $name The name of the element. - * @param string|array $value The value of the element. - */ -function printItem($name, $value) { - assert('is_string($name)'); - assert('is_string($value) || is_array($value)'); - - if (is_string($value)) { - echo '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />'; - return; - } - - /* This is an array... */ - foreach ($value as $index => $item) { - printItem($name . '[' . var_export($index, TRUE) . ']', $item); - } -} - -foreach ($post as $name => $value) { - printItem($name, $value); -} - -?> - - - - <h2><?php echo($this->t('{admin:debug_sending_message_title}')); ?></h2> - - <p><?php echo($this->t('{admin:debug_sending_message_text_button}')); ?></p> - - <form method="post" action="<?php echo htmlspecialchars($this->data['destination']); ?>"> -<?php -foreach ($post as $name => $value) { - printItem($name, $value); -} -?> - <input type="submit" value="<?php echo($this->t('{admin:debug_sending_message_send}')); ?>" id="sendbutton" /> - </form> - - <h2><?php echo($this->t('{admin:debug_sending_message_msg_title}')); ?></h2> - - <p><?php echo($this->t('{admin:debug_sending_message_msg_text}')); ?></p> - - <pre style="overflow: scroll; border: 1px solid #eee"><?php echo $this->data['responseHTML']; ?></pre> - - <p><?php echo($this->t('{admin:debug_disable_debug_mode}')); ?></p> - -<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/www/example-simple/attributequery.php b/www/example-simple/attributequery.php index 1bd04410d58130914ba30d3808cb08ab0646fdc3..aecff87dba5a6b96920611d21893d5a9813bf588 100644 --- a/www/example-simple/attributequery.php +++ b/www/example-simple/attributequery.php @@ -21,7 +21,6 @@ function sendQuery($dataId, $url, $nameId) { $query->setNameId($nameId); $binding = new SAML2_HTTPRedirect(); - $binding->setDestination(sspmod_saml_Message::getDebugDestination()); $binding->send($query); } diff --git a/www/saml2/sp/SingleLogoutService.php b/www/saml2/sp/SingleLogoutService.php index b04f850aef8536bc518dc8a89e3b3fe329b95b95..1cf847b3d3187940b867f7c403e9113dfd943309 100644 --- a/www/saml2/sp/SingleLogoutService.php +++ b/www/saml2/sp/SingleLogoutService.php @@ -55,7 +55,6 @@ if ($message instanceof SAML2_LogoutRequest) { /* Send response. */ $binding = new SAML2_HTTPRedirect(); - $binding->setDestination(sspmod_saml_Message::getDebugDestination()); $binding->send($lr); } catch (Exception $exception) { throw new SimpleSAML_Error_Error('LOGOUTREQUEST', $exception); diff --git a/www/saml2/sp/initSLO.php b/www/saml2/sp/initSLO.php index dd19558d718ec23df86ef51ad832d81dcfdfe73a..b280a1311f342ebd2e32a25922bb25c3b9a23c0d 100644 --- a/www/saml2/sp/initSLO.php +++ b/www/saml2/sp/initSLO.php @@ -52,7 +52,6 @@ try { SimpleSAML_Logger::info('SAML2.0 - SP.initSLO: SP (' . $spEntityId . ') is sending logout request to IdP (' . $idpEntityId . ')'); $b = new SAML2_HTTPRedirect(); - $b->setDestination(sspmod_saml_Message::getDebugDestination()); $b->send($lr); diff --git a/www/saml2/sp/initSSO.php b/www/saml2/sp/initSSO.php index d38ce8a73e3b5a676f965fd5e4266e6d78adb291..b2abf60b82972749171c43db5eb29bc743656d16 100644 --- a/www/saml2/sp/initSSO.php +++ b/www/saml2/sp/initSSO.php @@ -165,7 +165,6 @@ try { $session->setData('SAML2:SP:SSO:Info', $ar->getId(), $info); $b = new SAML2_HTTPRedirect(); - $b->setDestination(sspmod_saml_Message::getDebugDestination()); $b->send($ar); } catch(Exception $exception) {