[java-opensaml] branch master updated: IDP-1212 - Log all outgoing SAML assertions

Scott Cantor cantor.2 at osu.edu
Thu Sep 6 20:13:23 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=8dfc5125f37435fa80de1b23faf3ba09690dfcae

The following commit(s) were added to refs/heads/master by this push:
       new  8dfc512   IDP-1212 - Log all outgoing SAML assertions
8dfc512 is described below

commit 8dfc5125f37435fa80de1b23faf3ba09690dfcae
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Sep 6 20:13:21 2018 -0400

    IDP-1212 - Log all outgoing SAML assertions
    
    https://issues.shibboleth.net/jira/browse/IDP-1212
    
    Add PROTOCOL_MESSAGE logger to EncryptAssertions action.
---
 .../saml/saml2/profile/impl/EncryptAssertions.java | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/EncryptAssertions.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/EncryptAssertions.java
index 5ef3b4b..8943a48 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/EncryptAssertions.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/EncryptAssertions.java
@@ -62,7 +62,10 @@ public class EncryptAssertions extends AbstractEncryptAction {
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(EncryptAssertions.class);
-    
+
+    /** Used to log protocol messages. */
+    private Logger protocolMessageLog = LoggerFactory.getLogger("PROTOCOL_MESSAGE");
+
     /** Strategy used to locate the {@link Response} to operate on. */
     @Nonnull private Function<ProfileRequestContext,StatusResponseType> responseLookupStrategy;
     
@@ -122,19 +125,20 @@ public class EncryptAssertions extends AbstractEncryptAction {
     @Override
     protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
         
+        if (protocolMessageLog.isDebugEnabled()) {
+            try {
+                final Element dom = XMLObjectSupport.marshall(response);
+                protocolMessageLog.debug("{} Response before assertion encryption:\n{}", getLogPrefix(),
+                        SerializeSupport.prettyPrintXML(dom));
+            } catch (final MarshallingException e) {
+                log.error("{} Unable to marshall message for logging purposes", getLogPrefix(), e);
+            }
+        }
+        
         final List<EncryptedAssertion> accumulator = new ArrayList<>(response.getAssertions().size());
         
         for (final Assertion assertion : response.getAssertions()) {
             try {
-                if (log.isDebugEnabled()) {
-                    try {
-                        final Element dom = XMLObjectSupport.marshall(assertion);
-                        log.debug("{} Assertion before encryption:\n{}", getLogPrefix(),
-                                SerializeSupport.prettyPrintXML(dom));
-                    } catch (final MarshallingException e) {
-                        log.error("{} Unable to marshall message for logging purposes", getLogPrefix(), e);
-                    }
-                }
                 accumulator.add(getEncrypter().encrypt(assertion));
             } catch (final EncryptionException e) {
                 log.warn("{} Error encrypting assertion", getLogPrefix(), e);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list