[java-identity-provider COMMIT] in /trunk: idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPa...

noreply at shibboleth.net noreply at shibboleth.net
Thu Feb 20 13:13:36 EST 2014


Author: scantor
Date: Thu Feb 20 13:13:36 2014
New Revision: 5419

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5419&view=rev
Log:
Implement SAML-aware RP context behavior.

Added:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/InitializeRelyingPartyContextFromSAMLPeer.java   (with props)
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/SAMLRelyingPartyIdLookupStrategy.java   (with props)
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/InitializeRelyingPartyContextFromSAMLPeerTest.java   (with props)
Modified:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java?rev=5419&r1=5418&r2=5419&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java Thu Feb 20 13:13:36 2014
@@ -17,13 +17,16 @@
 
 package net.shibboleth.idp.profile.context;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.idp.profile.config.ProfileConfiguration;
 import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.opensaml.messaging.context.BaseContext;
+import org.opensaml.messaging.context.navigate.ContextDataLookupFunction;
 
 /**
  * {@link BaseContext} containing relying party specific information, usually a
@@ -34,6 +37,12 @@
     /** The identifier for the relying party. */
     @Nullable private String relyingPartyId;
 
+    /** A pointer to a context tree containing identifying material for the relying party. */
+    @Nullable private BaseContext relyingPartyIdContextTree;
+    
+    /** A lookup stratgy for deriving a relying party ID based on contained information. */
+    @Nullable private ContextDataLookupFunction<RelyingPartyContext,String> relyingPartyIdLookupStrategy;
+    
     /** The relying party configuration. */
     @Nullable private RelyingPartyConfiguration relyingPartyConfiguration;
 
@@ -46,8 +55,14 @@
      * @return unique identifier of the relying party
      */
     @Nullable public String getRelyingPartyId() {
-        return relyingPartyId;
+        
+        if (relyingPartyId != null) {
+            return relyingPartyId;
+        } else {
+            return relyingPartyIdLookupStrategy.apply(this);
+        }
     }
+
 
     /**
      * Set the unique identifier of the relying party.
@@ -58,6 +73,47 @@
         relyingPartyId = StringSupport.trimOrNull(rpId);
     }
 
+    /**
+     * Get the context tree containing identifying information for this relying party.
+     * 
+     * <p>The subtree root may, but need not, be an actual subcontext of this context.</p>
+     * 
+     * @return context tree
+     */
+    @Nullable public BaseContext getRelyingPartyIdContextTree() {
+        return relyingPartyIdContextTree;
+    }
+    
+    /**
+     * Set the context tree containing identifying information for this relying party.
+     * 
+     * <p>The subtree root may, but need not, be an actual subcontext of this context.</p>
+     * 
+     * @param root  root of context tree
+     */
+    public void setRelyingPartyIdContextTree(@Nullable final BaseContext root) {
+        relyingPartyIdContextTree = root;
+    }
+    
+    /**
+     * Get the lookup strategy for a non-explicit relying party ID.
+     * 
+     * @return lookup strategy
+     */
+    @Nullable ContextDataLookupFunction<RelyingPartyContext,String> getRelyingPartyIdLookupStrategy() {
+        return relyingPartyIdLookupStrategy;
+    }
+    
+    /**
+     * Set the lookup strategy for a non-explicit relying party ID.
+     * 
+     * @param strategy  lookup strategy
+     */
+    public void setRelyingPartyIdLookupStrategy(
+            @Nonnull final ContextDataLookupFunction<RelyingPartyContext,String> strategy) {
+        relyingPartyIdLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
+    }
+    
     /**
      * Get the relying party configuration.
      * 



More information about the commits mailing list