[java-opensaml] branch main updated: OSJ-326 - Decrypter does not log the decrypted XML
Scott Cantor
cantor.2 at osu.edu
Mon Oct 26 20:20:16 UTC 2020
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=91d385dd41ebf557f6c7a57ddb64b75c3c06c419
The following commit(s) were added to refs/heads/main by this push:
new 91d385dd4 OSJ-326 - Decrypter does not log the decrypted XML
91d385dd4 is described below
commit 91d385dd41ebf557f6c7a57ddb64b75c3c06c419
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Oct 26 16:20:12 2020 -0400
OSJ-326 - Decrypter does not log the decrypted XML
https://issues.shibboleth.net/jira/browse/OSJ-326
---
.../opensaml/saml/saml2/encryption/Decrypter.java | 24 +++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Decrypter.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Decrypter.java
index 88c8530ec..6ba0d5493 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Decrypter.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Decrypter.java
@@ -23,6 +23,8 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.io.MarshallingException;
+import org.opensaml.core.xml.util.XMLObjectSupport;
import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml.saml2.core.Attribute;
@@ -38,6 +40,9 @@ import org.opensaml.xmlsec.encryption.support.EncryptedKeyResolver;
import org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+
+import net.shibboleth.utilities.java.support.xml.SerializeSupport;
/**
* Class which implements SAML2-specific options for {@link EncryptedElementType} objects.
@@ -178,6 +183,8 @@ public class Decrypter extends org.opensaml.xmlsec.encryption.support.Decrypter
log.error("SAML Decrypter encountered an error decrypting element content: {}", e.getMessage());
throw e;
}
+
+ logPostDecryption(xmlObject);
if (! (xmlObject instanceof SAMLObject)) {
throw new DecryptionException("Decrypted XMLObject was not an instance of SAMLObject");
@@ -186,4 +193,19 @@ public class Decrypter extends org.opensaml.xmlsec.encryption.support.Decrypter
return (SAMLObject) xmlObject;
}
-}
+ /**
+ * Log the target object after decryption.
+ *
+ * @param xmlObject the decrypted XMLObject
+ */
+ private void logPostDecryption(final XMLObject xmlObject) {
+ if (log.isDebugEnabled()) {
+ try {
+ final Element dom = XMLObjectSupport.marshall(xmlObject);
+ log.debug("XML after decryption:\n{}", SerializeSupport.prettyPrintXML(dom));
+ } catch (final MarshallingException e) {
+ log.error("Unable to marshall decrypted XML for logging purposes", e);
+ }
+ }
+ }
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list