[java-identity-provider] branch master updated: Finalize wiring and defaults for MessageContext case.

Scott Cantor cantor.2 at osu.edu
Mon Oct 1 10:23:16 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=c093808b9461a6d28e7bdadc8699a0f9a10a6ff4

The following commit(s) were added to refs/heads/master by this push:
       new  c093808   Finalize wiring and defaults for MessageContext case.
c093808 is described below

commit c093808b9461a6d28e7bdadc8699a0f9a10a6ff4
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Oct 1 10:20:05 2018 -0400

    Finalize wiring and defaults for MessageContext case.
---
 .../system/conf/relying-party-mddriven.xml         | 20 ------------------
 ...tMetadataDrivenConfigurationLookupStrategy.java | 24 +++++++++++++++++++---
 2 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/idp-conf/src/main/resources/system/conf/relying-party-mddriven.xml b/idp-conf/src/main/resources/system/conf/relying-party-mddriven.xml
index cf2ec28..c187af1 100644
--- a/idp-conf/src/main/resources/system/conf/relying-party-mddriven.xml
+++ b/idp-conf/src/main/resources/system/conf/relying-party-mddriven.xml
@@ -61,17 +61,7 @@
 
     <!-- ProfileRequestContext-based access to metadata properties of various types. -->
 
-    <bean id="shibboleth.MDDrivenMetadataLookup" class="com.google.common.base.Functions" factory-method="compose">
-        <constructor-arg name="g">
-            <bean class="org.opensaml.saml.common.messaging.context.navigate.EntityDescriptorLookupFunction" />
-        </constructor-arg>
-        <constructor-arg name="f">
-            <bean class="net.shibboleth.idp.saml.profile.context.navigate.SAMLMetadataContextLookupFunction" />
-        </constructor-arg>
-    </bean>
-    
     <bean id="shibboleth.AbstractMDDrivenProperty" abstract="true"
-        p:metadataLookupStrategy-ref="shibboleth.MDDrivenMetadataLookup"
         p:profileAliases="#{getObject('shibboleth.MDProfileAliases') ?: getObject('shibboleth.DefaultMDProfileAliases')}" />
     
     <bean id="shibboleth.MDDrivenStringProperty" abstract="true" parent="shibboleth.AbstractMDDrivenProperty"
@@ -97,17 +87,7 @@
 
     <!-- MessageContext-based access to metadata properties of various types. -->
 
-    <bean id="shibboleth.MDDrivenMessagingMetadataLookup" class="com.google.common.base.Functions" factory-method="compose">
-        <constructor-arg name="g">
-            <bean class="org.opensaml.saml.common.messaging.context.navigate.EntityDescriptorLookupFunction" />
-        </constructor-arg>
-        <constructor-arg name="f">
-            <bean class="net.shibboleth.idp.saml.profile.context.navigate.messaging.SAMLMetadataContextLookupFunction" />
-        </constructor-arg>
-    </bean>
-
     <bean id="shibboleth.AbstractMDDrivenMessagingProperty" parent="shibboleth.AbstractMDDrivenProperty" abstract="true"
-        p:metadataLookupStrategy-ref="shibboleth.MDDrivenMessagingMetadataLookup"
         p:profileIdLookupStrategy-ref="SOAPClient.SOAPClientSecurityProfileIdLookup" />
 
     <bean id="shibboleth.MDDrivenBoolMessagingProperty" abstract="true" parent="shibboleth.AbstractMDDrivenMessagingProperty"
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java
index 9d8a885..af5557e 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java
@@ -29,6 +29,7 @@ import javax.annotation.Nullable;
 
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.messaging.context.BaseContext;
+import org.opensaml.messaging.context.MessageContext;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.opensaml.profile.context.navigate.ProfileIdLookup;
 import org.opensaml.saml.common.messaging.context.navigate.EntityDescriptorLookupFunction;
@@ -37,6 +38,7 @@ import org.opensaml.saml.saml2.core.Attribute;
 import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
 import org.opensaml.saml.saml2.metadata.EntityDescriptor;
 import org.opensaml.saml.saml2.metadata.Extensions;
+import org.opensaml.soap.client.security.SOAPClientSecurityProfileIdLookupFunction;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +46,6 @@ import com.google.common.base.Function;
 import com.google.common.base.Functions;
 import com.google.common.collect.Collections2;
 
-import net.shibboleth.idp.saml.profile.context.navigate.SAMLMetadataContextLookupFunction;
 import net.shibboleth.utilities.java.support.annotation.constraint.Live;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -77,6 +78,12 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
     /** Default profile ID lookup for PRC-based usage. */
     @Nonnull private static final Function<ProfileRequestContext,String> DEFAULT_PRC_PROFILE_ID_LOOKUP;
 
+    /** Default metadata lookup for MC-based usage. */
+    @Nonnull private static final Function<MessageContext,EntityDescriptor> DEFAULT_MC_METADATA_LOOKUP;
+
+    /** Default profile ID lookup for MC-based usage. */
+    @Nonnull private static final Function<MessageContext,String> DEFAULT_MC_PROFILE_ID_LOOKUP;
+
     /** Class logger. */
     @Nonnull
     private final Logger log = LoggerFactory.getLogger(AbstractMetadataDrivenConfigurationLookupStrategy.class);
@@ -202,7 +209,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
         
         CachedConfigurationContext cacheContext = null;
         
-        if (enableCaching) {
+        if (enableCaching && input != null) {
             cacheContext = input.getSubcontext(CachedConfigurationContext.class, true);
             if (cacheContext.getPropertyMap().containsKey(propertyName)) {
                 log.debug("Returning cached property '{}'", propertyName);
@@ -217,6 +224,8 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
             entity = metadataLookupStrategy.apply(input);
         } else if (input instanceof ProfileRequestContext) {
             entity = DEFAULT_PRC_METADATA_LOOKUP.apply((ProfileRequestContext) input);
+        } else if (input instanceof MessageContext) {
+            entity = DEFAULT_MC_METADATA_LOOKUP.apply((MessageContext) input);
         } else {
             entity = null;
         }
@@ -230,6 +239,8 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
             profileId = profileIdLookupStrategy.apply(input);
         } else if (input instanceof ProfileRequestContext) {
             profileId = DEFAULT_PRC_PROFILE_ID_LOOKUP.apply((ProfileRequestContext) input);
+        } else if (input instanceof MessageContext) {
+            profileId = DEFAULT_MC_PROFILE_ID_LOOKUP.apply((MessageContext) input);
         } else {
             profileId = "";
         }
@@ -381,8 +392,15 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
         // Init PRC defaults.
         
         DEFAULT_PRC_METADATA_LOOKUP = Functions.compose(new EntityDescriptorLookupFunction(),
-                new SAMLMetadataContextLookupFunction());
+                new net.shibboleth.idp.saml.profile.context.navigate.SAMLMetadataContextLookupFunction());
         
         DEFAULT_PRC_PROFILE_ID_LOOKUP = new ProfileIdLookup();
+
+        // Init MC defaults.
+
+        DEFAULT_MC_METADATA_LOOKUP = Functions.compose(new EntityDescriptorLookupFunction(),
+                new net.shibboleth.idp.saml.profile.context.navigate.messaging.SAMLMetadataContextLookupFunction());
+        
+        DEFAULT_MC_PROFILE_ID_LOOKUP = new SOAPClientSecurityProfileIdLookupFunction();
     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list