[java-opensaml COMMIT] /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateSignatur...

noreply at shibboleth.net noreply at shibboleth.net
Mon May 12 13:20:34 EDT 2014


Author: scantor
Date: Mon May 12 13:20:34 2014
New Revision: 3862

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

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateSignatureSigningParameters.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateSignatureSigningParameters.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateSignatureSigningParameters.java?rev=3862&r1=3861&r2=3862&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateSignatureSigningParameters.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateSignatureSigningParameters.java Mon May 12 13:20:34 2014
@@ -45,6 +45,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;
@@ -75,8 +76,8 @@
     @NonnullAfterInit
     private Function<ProfileRequestContext,List<SignatureSigningConfiguration>> configurationLookupStrategy;
 
-    /** 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;
     
     /** Resolver for parameters to store into context. */
     @NonnullAfterInit private SignatureSigningParametersResolver resolver;
@@ -91,11 +92,10 @@
         securityParametersContextLookupStrategy = Functions.compose(
                 new ChildContextLookup<>(SecurityParametersContext.class, true), new OutboundMessageContextLookup());
 
-        // 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());
     }
 
     /**
@@ -123,17 +123,17 @@
 
         existingParametersContextLookupStrategy = strategy;
     }
-    
-    /**
-     * 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;
     }
 
     /**
@@ -225,11 +225,20 @@
         
         final CriteriaSet criteria = new CriteriaSet(new SignatureSigningConfigurationCriterion(configs));
         
-        if (metadataContextLookupStrategy != null) {
-            final SAMLMetadataContext metadataCtx = metadataContextLookupStrategy.apply(profileRequestContext);
-            if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null) {
-                log.debug("{} Adding metadata to resolution criteria for signing/digest algorithms", 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 for signing/digest algorithms",
+                            getLogPrefix());
+                    criteria.add(new EntityIdCriterion(peerCtx.getEntityId()));
+                }
+                final SAMLMetadataContext metadataCtx = peerCtx.getSubcontext(SAMLMetadataContext.class);
+                if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null) {
+                    log.debug("{} Adding role metadata to resolution criteria for signing/digest algorithms",

[... 7 lines stripped ...]


More information about the commits mailing list