[java-identity-provider COMMIT] in /trunk: idp-conf/src/main/resources/conf/subject-c14n-user.xml idp-profile-impl/sr...

noreply at shibboleth.net noreply at shibboleth.net
Thu May 8 00:07:56 EDT 2014


Author: scantor
Date: Thu May  8 00:07:56 2014
New Revision: 5881

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5881&view=rev
Log:
Prototype of a more generalized predicate.

Modified:
    trunk/idp-conf/src/main/resources/conf/subject-c14n-user.xml
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/RelyingPartyIdPredicate.java

Modified: trunk/idp-conf/src/main/resources/conf/subject-c14n-user.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/conf/subject-c14n-user.xml?rev=5881&r1=5880&r2=5881&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/conf/subject-c14n-user.xml (original)
+++ trunk/idp-conf/src/main/resources/conf/subject-c14n-user.xml Thu May  8 00:07:56 2014
@@ -77,11 +77,11 @@
     <!-- Under what conditions should direct mapping be allowed? By default, never. -->
     <!-- TODO: can we override this from the tests so we can remove it here? -->
     <bean id="shibboleth.DirectNamePredicate" class="net.shibboleth.idp.profile.logic.RelyingPartyIdPredicate">
-        <property name="relyingPartyIds">
+        <constructor-arg>
             <util:list>
                 <value>https://sp.example.org</value>
             </util:list>
-        </property>
+        </constructor-arg>
     </bean>
             
 </beans>

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/RelyingPartyIdPredicate.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/RelyingPartyIdPredicate.java?rev=5881&r1=5880&r2=5881&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/RelyingPartyIdPredicate.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/RelyingPartyIdPredicate.java Thu May  8 00:07:56 2014
@@ -18,82 +18,47 @@
 package net.shibboleth.idp.profile.logic;
 
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 
 import net.shibboleth.idp.profile.context.navigate.RelyingPartyIdLookupFunction;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.logic.CollectionContainmentPredicate;
+import net.shibboleth.utilities.java.support.logic.FunctionSupport;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.opensaml.profile.context.ProfileRequestContext;
 
 import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Sets;
 
 /**
  * Predicate that evaluates a {@link ProfileRequestContext} by looking for relying party ID
- * that matches one of a designated set, obtained from a lookup function, by default from
- * a {@link net.shibboleth.idp.profile.context.RelyingPartyContext} child.
+ * that matches one of a designated set. The ID is obtained from a lookup function, by default from
+ * a {@link net.shibboleth.idp.profile.context.RelyingPartyContext} child of the profile request context.
  */
-public class RelyingPartyIdPredicate implements Predicate<ProfileRequestContext> {
+public class RelyingPartyIdPredicate extends CollectionContainmentPredicate<ProfileRequestContext,String> {
 
-    /** Lookup strategy for relying party ID. */
-    @Nonnull private Function<ProfileRequestContext,String> relyingPartyIdLookupStrategy;
-    
-    /** Relying parties to match against. */
-    @Nonnull @NonnullElements private Set<String> relyingPartyIds;
-
-    /** Constructor. */
-    public RelyingPartyIdPredicate() {
-        relyingPartyIdLookupStrategy = new RelyingPartyIdLookupFunction();
-        relyingPartyIds = Collections.emptySet();
+    /**
+     * Constructor.
+     * 
+     * @param candidates hardwired set of values to check against
+     */
+    public RelyingPartyIdPredicate(@Nonnull @NonnullElements final Collection<String> candidates) {
+        super(new RelyingPartyIdLookupFunction(),
+                FunctionSupport.<ProfileRequestContext,Collection<String>>constant(
+                        StringSupport.normalizeStringCollection(candidates)));
     }
 
     /**
-     * Set the strategy used to obtain the relying party ID for this request.
+     * Constructor.
      * 
-     * @param strategy  lookup strategy
+     * @param relyingPartyIdLookupStrategy  lookup strategy for relying party ID
+     * @param candidates hardwired set of values to check against
      */
-    public synchronized void setRelyingPartyIdLookupStrategy(
-            @Nonnull final Function<ProfileRequestContext,String> strategy) {
-        
-        relyingPartyIdLookupStrategy = Constraint.isNotNull(strategy,
-                "Relying party ID lookup strategy cannot be null");

[... 39 lines stripped ...]


More information about the commits mailing list