[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/saml2/profile/delegati...

noreply at shibboleth.net noreply at shibboleth.net
Tue Oct 20 20:40:58 EDT 2015


Author: putmanb
Date: Tue Oct 20 20:40:58 2015
New Revision: 7840

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7840&view=rev
Log:
IDP-672: Create Action(s) and supporting code to issue SAML 2 Assertions decorated for delegation

In preExecute(...) evaluate the super method (the activation condition) early rather than at the end.
If activation condition is not going to fire, shouldn't execute any action code, esp if any of it could
terminate in a fatal error.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContextTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java?rev=7840&r1=7839&r2=7840&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java	(original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java	Tue Oct 20 20:40:58 2015
@@ -221,6 +221,12 @@
     protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
         
+        // Eval the activation condition first.  Don't bother with the rest if false, esp since
+        // could terminate with a fatal error unnecessarily.
+        if (!super.doPreExecute(profileRequestContext)) {
+            return false;
+        }
+        
         assertions = assertionLookupStrategy.apply(profileRequestContext);
         if (assertions == null || assertions.isEmpty()) {
             log.debug("No Assertions found to decorate, skipping further processing");
@@ -235,7 +241,7 @@
             return false;
         }
         
-        return super.doPreExecute(profileRequestContext);
+        return true;
     }
     
     /**

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java?rev=7840&r1=7839&r2=7840&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java	(original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java	Tue Oct 20 20:40:58 2015
@@ -218,6 +218,12 @@
     protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
         
+        // Eval the activation condition first.  Don't bother with the rest if false, esp since
+        // could terminate with a fatal error unnecessarily.
+        if (!super.doPreExecute(profileRequestContext)) {
+            return false;
+        }
+        
         if (!doPreExecuteInbound(profileRequestContext)) {
             return false;
         }
@@ -238,7 +244,7 @@
         
         confirmationCredentials = resolveConfirmationCredentials(profileRequestContext);
         
-        return super.doPreExecute(profileRequestContext);
+        return true;
     }
     // Checkstyle: ReturnCount ON
     

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java?rev=7840&r1=7839&r2=7840&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java	(original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java	Tue Oct 20 20:40:58 2015
@@ -81,6 +81,7 @@
 import org.w3c.dom.Element;
 
 import com.google.common.base.Function;
+import com.google.common.base.Predicates;
 
 /**
  *
@@ -242,6 +243,21 @@
     @Test
     public void testNoAssertions() throws Exception {
         response.getAssertions().clear();

[... 50 lines stripped ...]


More information about the commits mailing list