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

noreply at shibboleth.net noreply at shibboleth.net
Tue Oct 13 21:15:23 EDT 2015


Author: putmanb
Date: Tue Oct 13 21:15:23 2015
New Revision: 7819

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

Make delegation predicate consistent with other code and use a lookup strategy for the DelegationContext.

Modified:
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/IssuingDelegatedAssertionPredicate.java

Modified: trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/IssuingDelegatedAssertionPredicate.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/IssuingDelegatedAssertionPredicate.java?rev=7819&r1=7818&r2=7819&view=diff
==============================================================================
--- trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/IssuingDelegatedAssertionPredicate.java	(original)
+++ trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/IssuingDelegatedAssertionPredicate.java	Tue Oct 13 21:15:23 2015
@@ -17,10 +17,15 @@
 
 package net.shibboleth.idp.saml.saml2.profile.delegation;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.utilities.java.support.logic.Constraint;
+
+import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.opensaml.profile.context.ProfileRequestContext;
 
+import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 
 /**
@@ -28,13 +33,32 @@
  * SAML 2 {@link org.opensaml.saml.saml2.core.Assertion} is active.
  */
 public class IssuingDelegatedAssertionPredicate implements Predicate<ProfileRequestContext> {
-
+    
+    /** Strategy used to lookup the {@link DelegationContext. */
+    @Nonnull private Function<ProfileRequestContext, DelegationContext> delegationContextLookupStrategy;
+    
+    /** Constructor. */
+    public IssuingDelegatedAssertionPredicate() {
+        delegationContextLookupStrategy = new ChildContextLookup<>(DelegationContext.class);
+    }
+    
+    /**
+     * Set the strategy used to locate the current {@link DelegationContext}.
+     * 
+     * @param strategy strategy used to locate the current {@link DelegationContext}
+     */
+    public void setDelegationContextLookupStrategy(
+            @Nonnull final Function<ProfileRequestContext, DelegationContext> strategy) {
+        delegationContextLookupStrategy = Constraint.isNotNull(strategy, 
+                "DelegationContext lookup strategy may not be null");
+    }
+    
     /** {@inheritDoc} */
     public boolean apply(@Nullable ProfileRequestContext input) {
         if (input == null) {
             return false;
         }
-        DelegationContext delegationContext = input.getSubcontext(DelegationContext.class);
+        DelegationContext delegationContext = delegationContextLookupStrategy.apply(input);
         if (delegationContext == null) {
             return false;
         }



More information about the commits mailing list