[java-identity-provider COMMIT] /trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/m...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jun 19 20:21:39 EDT 2015


Author: putmanb
Date: Fri Jun 19 20:21:38 2015
New Revision: 7581

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7581&view=rev
Log:
Apply changes to SOAP fault handling to Liberty clone of SOAP 1.1 encoder.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11Encoder.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11Encoder.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11Encoder.java?rev=7581&r1=7580&r2=7581&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11Encoder.java	(original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11Encoder.java	Fri Jun 19 20:21:38 2015
@@ -37,6 +37,7 @@
 import org.opensaml.saml.common.SAMLObject;
 import org.opensaml.saml.common.binding.encoding.SAMLMessageEncoder;
 import org.opensaml.soap.common.SOAPObjectBuilder;
+import org.opensaml.soap.messaging.SOAPMessagingSupport;
 import org.opensaml.soap.messaging.context.SOAP11Context;
 import org.opensaml.soap.soap11.Body;
 import org.opensaml.soap.soap11.Envelope;
@@ -83,15 +84,26 @@
     /** {@inheritDoc} */
     public void prepareContext() throws MessageEncodingException {
         MessageContext<SAMLObject> messageContext = getMessageContext();
-        SAMLObject message = messageContext.getMessage();
-        if (message == null) {
-            throw new MessageEncodingException("No outbound message contained in message context");
-        }
-        
-        if (message instanceof Envelope) {
-            storeSOAPEnvelope((Envelope) message);
-        } else {
-            buildAndStoreSOAPMessage(message);
+        XMLObject payload = null;
+        
+        Fault fault = SOAPMessagingSupport.getSOAP11Fault(messageContext);
+        if (fault != null) {
+            log.debug("Saw SOAP 1.1 Fault payload with fault code, replacing any existing context message: {}", 
+                    fault.getCode() != null ? fault.getCode().getValue() : null);
+            payload = fault;
+            messageContext.setMessage(null);
+        } else {
+            payload = messageContext.getMessage();
+        }
+        
+        if (payload == null) {
+            throw new MessageEncodingException("No outbound message or Fault contained in message context");
+        }
+        
+        if (payload instanceof Envelope) {
+            storeSOAPEnvelope((Envelope) payload);
+        } else {
+            buildAndStoreSOAPMessage(payload);
         }
         
     }



More information about the commits mailing list