From b81bcd9101fbc92813cda030e8010288bcef5637 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Thu, 17 Jan 2008 13:09:58 +0000
Subject: [PATCH] Adding debug mode for Shibboleth AuthnResponse. If you turn
 on the debug option in config.php you will now get the web page showing the
 authnresponse, as it earlier did with SAML 2.0

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@169 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Bindings/Shib13/HTTPPost.php | 37 +++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
index 3b200430a..cf58af4e8 100644
--- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
+++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
@@ -146,14 +146,39 @@ class SimpleSAML_Bindings_Shib13_HTTPPost {
 		# openssl req -new -key server.key -out server.csr
 		# openssl x509 -req -days 60 -in server.csr -signkey server.key -out server.crt
 		
-		$p = new SimpleSAML_XHTML_Template($this->configuration, 'post.php');
+
+		
+		
+		
+		if ($this->configuration->getValue('debug')) {
 	
-		$p->data['RelayStateName'] = 'TARGET';
-		$p->data['RelayState'] = $relayState;
-		$p->data['destination'] = $destination;
-		$p->data['response'] = base64_encode($response);
+			$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'] = $destination;
+			$p->data['response'] = str_replace("\n", "", base64_encode($response));
+			$p->data['responseHTML'] = htmlentities($responsedom->saveHTML());
+			
+			$p->show();
+
+		
+		} else {
+			
+			$p = new SimpleSAML_XHTML_Template($this->configuration, 'post.php');
+		
+			$p->data['RelayStateName'] = 'TARGET';
+			$p->data['RelayState'] = $relayState;
+			$p->data['destination'] = $destination;
+			$p->data['response'] = base64_encode($response);
+			
+			$p->show();
+
+		
+		}
+		
 		
-		$p->show();
 		/*
 		
 		
-- 
GitLab