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

noreply at shibboleth.net noreply at shibboleth.net
Mon May 12 13:23:25 EDT 2014


Author: scantor
Date: Mon May 12 13:23:25 2014
New Revision: 5913

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5913&view=rev
Log:
Add entityID criterion to resolution process.

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

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/PopulateEncryptionParameters.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/PopulateEncryptionParameters.java?rev=5913&r1=5912&r2=5913&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/PopulateEncryptionParameters.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/PopulateEncryptionParameters.java Mon May 12 13:23:25 2014
@@ -49,6 +49,7 @@
 import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 import net.shibboleth.utilities.java.support.resolver.ResolverException;
 
+import org.opensaml.core.criterion.EntityIdCriterion;
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -85,8 +86,8 @@
     /** Strategy used to look up the {@link EncryptionContext} to store parameters in. */
     @Nonnull private Function<ProfileRequestContext,EncryptionContext> encryptionContextLookupStrategy;
 
-    /** Strategy used to look up a SAML metadata context. */
-    @Nullable private Function<ProfileRequestContext,SAMLMetadataContext> metadataContextLookupStrategy;
+    /** Strategy used to look up a SAML peer context. */
+    @Nullable private Function<ProfileRequestContext,SAMLPeerEntityContext> peerContextLookupStrategy;
     
     /** Strategy used to look up a per-request {@link EncryptionConfiguration} list. */
     @NonnullAfterInit private Function<ProfileRequestContext,List<EncryptionConfiguration>> configurationLookupStrategy;
@@ -123,11 +124,10 @@
                 new ChildContextLookup<>(EncryptionContext.class, true),
                 new ChildContextLookup<ProfileRequestContext,RelyingPartyContext>(RelyingPartyContext.class));
 
-        // Default: outbound msg context -> SAMLPeerEntityContext -> SAMLMetadataContext
-        metadataContextLookupStrategy = Functions.compose(
-                new ChildContextLookup<>(SAMLMetadataContext.class),
+        // Default: outbound msg context -> SAMLPeerEntityContext
+        peerContextLookupStrategy =
                 Functions.compose(new ChildContextLookup<>(SAMLPeerEntityContext.class),
-                        new OutboundMessageContextLookup()));
+                        new OutboundMessageContextLookup());
     }
     
     /**
@@ -170,17 +170,17 @@
         configurationLookupStrategy = Constraint.isNotNull(strategy,
                 "EncryptionConfiguration lookup strategy cannot be null");
     }
-    
-    /**
-     * Set lookup strategy for {@link SAMLMetadataContext} for input to resolution.
+
+    /**
+     * Set lookup strategy for {@link SAMLPeerEntityContext} for input to resolution.
      * 
      * @param strategy  lookup strategy
      */
-    public void setMetadataContextLookupStrategy(
-            @Nullable final Function<ProfileRequestContext,SAMLMetadataContext> strategy) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        
-        metadataContextLookupStrategy = strategy;
+    public void setPeerContextLookupStrategy(
+            @Nullable final Function<ProfileRequestContext,SAMLPeerEntityContext> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        peerContextLookupStrategy = strategy;
     }
     
     /**
@@ -313,11 +313,18 @@
         
         final CriteriaSet criteria = new CriteriaSet(new EncryptionConfigurationCriterion(encryptionConfigurations));
         
-        if (metadataContextLookupStrategy != null) {
-            final SAMLMetadataContext metadataCtx = metadataContextLookupStrategy.apply(profileRequestContext);
-            if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null) {
-                log.debug("{} Adding metadata to resolution", getLogPrefix());
-                criteria.add(new RoleDescriptorCriterion(metadataCtx.getRoleDescriptor()));
+        if (peerContextLookupStrategy != null) {
+            final SAMLPeerEntityContext peerCtx = peerContextLookupStrategy.apply(profileRequestContext);
+            if (peerCtx != null) {
+                if (peerCtx.getEntityId() != null) {
+                    log.debug("{} Adding entityID to resolution criteria", getLogPrefix());
+                    criteria.add(new EntityIdCriterion(peerCtx.getEntityId()));
+                }
+                final SAMLMetadataContext metadataCtx = peerCtx.getSubcontext(SAMLMetadataContext.class);
+                if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null) {

[... 7 lines stripped ...]


More information about the commits mailing list