Skip to content
Snippets Groups Projects
Commit 42c5dc3b authored by Olav Morken's avatar Olav Morken
Browse files

Utilities::debugMessage: Allow DOMelement as $message parameter.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2546 44740490-163a-0410-bde0-09ae8108e29a
parent d4dc0947
No related branches found
No related tags found
No related merge requests found
...@@ -46,8 +46,7 @@ class SAML2_EncryptedAssertion { ...@@ -46,8 +46,7 @@ class SAML2_EncryptedAssertion {
$xml = $assertion->toXML(); $xml = $assertion->toXML();
$xmlStr = $xml->ownerDocument->saveXML($xml); SimpleSAML_Utilities::debugMessage($xml, 'encrypt');
SimpleSAML_Utilities::debugMessage($xmlStr, 'encrypt');
$enc = new XMLSecEnc(); $enc = new XMLSecEnc();
$enc->setNode($xml); $enc->setNode($xml);
...@@ -88,8 +87,7 @@ class SAML2_EncryptedAssertion { ...@@ -88,8 +87,7 @@ class SAML2_EncryptedAssertion {
$assertionXML = SAML2_Utils::decryptElement($this->encryptedData, $inputKey); $assertionXML = SAML2_Utils::decryptElement($this->encryptedData, $inputKey);
$xmlStr = $assertionXML->ownerDocument->saveXML($assertionXML); SimpleSAML_Utilities::debugMessage($assertionXML, 'decrypt');
SimpleSAML_Utilities::debugMessage($xmlStr, 'decrypt');
return new SAML2_Assertion($assertionXML); return new SAML2_Assertion($assertionXML);
} }
......
...@@ -1910,11 +1910,11 @@ class SimpleSAML_Utilities { ...@@ -1910,11 +1910,11 @@ class SimpleSAML_Utilities {
/** /**
* Helper function to log messages that we send or receive. * Helper function to log messages that we send or receive.
* *
* @param string $message The message, as an XML string. * @param string|DOMElement $message The message, as an XML string or an XML element.
* @param string $type Whether this message is sent or received, encrypted or decrypted. * @param string $type Whether this message is sent or received, encrypted or decrypted.
*/ */
public static function debugMessage($message, $type) { public static function debugMessage($message, $type) {
assert('is_string($message)'); assert('is_string($message) || $message instanceof DOMElement');
$globalConfig = SimpleSAML_Configuration::getInstance(); $globalConfig = SimpleSAML_Configuration::getInstance();
if (!$globalConfig->getBoolean('debug', FALSE)) { if (!$globalConfig->getBoolean('debug', FALSE)) {
...@@ -1922,6 +1922,10 @@ class SimpleSAML_Utilities { ...@@ -1922,6 +1922,10 @@ class SimpleSAML_Utilities {
return; return;
} }
if ($message instanceof DOMElement) {
$message = $message->ownerDocument->saveXML($message);
}
switch ($type) { switch ($type) {
case 'in': case 'in':
SimpleSAML_Logger::debug('Received message:'); SimpleSAML_Logger::debug('Received message:');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment