[java-identity-provider] branch maint-3.4 updated: IDP-1363: InlineMetadataProvider should support indexesRef ...

Brent Putman putmanb at georgetown.edu
Fri Dec 14 17:10:09 EST 2018


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

putmanb pushed a commit to branch maint-3.4
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/maint-3.4 by this push:
       new  6c81bf4   IDP-1363: InlineMetadataProvider should support indexesRef ...
6c81bf4 is described below

commit 6c81bf4e10fc6c6b829c6454b5b4b102017d1a73
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Fri Dec 14 17:04:34 2018 -0500

    IDP-1363: InlineMetadataProvider should support indexesRef ...
    
    InlineMetadataProvider should support indexesRef and
    resolveViaPredicatesOnly.
---
 .../impl/InlineMetadataProviderParser.java         | 12 +++++++++++
 .../metadata/InlineMetadataParserTest.java         | 23 ++++++++++++++--------
 .../relyingparty/metadata/inLineEntities.xml       |  5 ++++-
 .../spring/relyingparty/metadata/inLineEntity.xml  |  3 +++
 .../main/resources/schema/shibboleth-metadata.xsd  | 16 +++++++++++++++
 5 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/InlineMetadataProviderParser.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/InlineMetadataProviderParser.java
index 0f8aeb3..e40faeb 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/InlineMetadataProviderParser.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/InlineMetadataProviderParser.java
@@ -23,6 +23,7 @@ import javax.annotation.Nonnull;
 import javax.xml.namespace.QName;
 
 import net.shibboleth.idp.profile.spring.relyingparty.metadata.AbstractMetadataProviderParser;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.xml.ElementSupport;
 
 import org.opensaml.saml.common.xml.SAMLConstants;
@@ -55,6 +56,17 @@ public class InlineMetadataProviderParser extends AbstractMetadataProviderParser
                     ElementSupport.getChildElementsByTagNameNS(element, SAMLConstants.SAML20MD_NS, "EntityDescriptor");
         }
         builder.addConstructorArgValue(metadataContent.get(0));
+        
+        if (element.hasAttributeNS(null, "indexesRef")) {
+            builder.addPropertyReference("indexes",
+                    StringSupport.trimOrNull(element.getAttributeNS(null, "indexesRef")));
+        }
+        
+        if (element.hasAttributeNS(null, "resolveViaPredicatesOnly")) {
+            builder.addPropertyValue("resolveViaPredicatesOnly",
+                    StringSupport.trimOrNull(element.getAttributeNS(null, "resolveViaPredicatesOnly")));
+        }
+        
     }
     
 }
\ No newline at end of file
diff --git a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/InlineMetadataParserTest.java b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/InlineMetadataParserTest.java
index 68ebb32..492e8dd 100644
--- a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/InlineMetadataParserTest.java
+++ b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/InlineMetadataParserTest.java
@@ -37,33 +37,40 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.support.ConversionServiceFactoryBean;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
 public class InlineMetadataParserTest extends AbstractMetadataParserTest {
 
     @Test public void entity() throws ResolverException, IOException {
-        final DOMMetadataResolver resolver = getBean(DOMMetadataResolver.class, "inLineEntity.xml");
+        final DOMMetadataResolver resolver = getBean(DOMMetadataResolver.class, "inLineEntity.xml", "beans.xml");
 
         Assert.assertEquals(resolver.getId(), "inLineEntity");
 
-        final Iterator<EntityDescriptor> entities = resolver.resolve(criteriaFor(IDP_ID)).iterator();
         Assert.assertTrue(resolver.isFailFastInitialization());
         Assert.assertTrue(resolver.isRequireValidMetadata());
+        
+        Assert.assertTrue(resolver.isResolveViaPredicatesOnly());
+        Assert.assertNotNull(resolver.getIndexes());
+        Assert.assertFalse(resolver.getIndexes().isEmpty());
 
+        final Iterator<EntityDescriptor> entities = resolver.resolve(criteriaFor(IDP_ID)).iterator();
         Assert.assertEquals(entities.next().getEntityID(), IDP_ID);
         Assert.assertFalse(entities.hasNext());
 
     }
 
     @Test public void entities() throws ResolverException, IOException {
-        final DOMMetadataResolver resolver = getBean(DOMMetadataResolver.class, "inLineEntities.xml");
+        final DOMMetadataResolver resolver = getBean(DOMMetadataResolver.class, "inLineEntities.xml", "beans.xml");
 
         Assert.assertEquals(resolver.getId(), "inLineEntities");
 
         Assert.assertFalse(resolver.isFailFastInitialization());
         Assert.assertFalse(resolver.isRequireValidMetadata());
+        
+        Assert.assertTrue(resolver.isResolveViaPredicatesOnly());
+        Assert.assertNotNull(resolver.getIndexes());
+        Assert.assertFalse(resolver.getIndexes().isEmpty());
 
         Assert.assertNull(resolver.resolveSingle(criteriaFor(IDP_ID)));
         Assert.assertNotNull(resolver.resolveSingle(criteriaFor(SP_ID)));
@@ -86,10 +93,10 @@ public class InlineMetadataParserTest extends AbstractMetadataParserTest {
 
         configReader.setValidating(true);
 
-        final Resource r =
-                new ClassPathResource("/net/shibboleth/idp/profile/spring/relyingparty/metadata/multipleResolvers.xml");
-
-        configReader.loadBeanDefinitions(r);
+        configReader.loadBeanDefinitions(
+                new ClassPathResource("/net/shibboleth/idp/profile/spring/relyingparty/metadata/beans.xml"),
+                new ClassPathResource("/net/shibboleth/idp/profile/spring/relyingparty/metadata/multipleResolvers.xml")
+                );
         context.refresh();
 
         final ReloadableSpringService<MetadataResolver> ms =
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntities.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntities.xml
index 9c8420f..5b2d3b7 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntities.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntities.xml
@@ -4,7 +4,10 @@
 	xsi:schemaLocation="urn:mace:shibboleth:2.0:metadata http://shibboleth.net/schema/idp/shibboleth-metadata.xsd
                        urn:oasis:names:tc:SAML:2.0:metadata http://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd"
 
-failFastInitialization="false" requireValidMetadata="false"
+    failFastInitialization="false" 
+    requireValidMetadata="false"
+    resolveViaPredicatesOnly="true"
+    indexesRef="metadata.Indexes"
 
 	id="inLineEntities" xsi:type="metadata:InlineMetadataProvider">
 	<samlmd:EntitiesDescriptor>
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntity.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntity.xml
index 15b3a06..e5af031 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntity.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/inLineEntity.xml
@@ -4,6 +4,9 @@
 	xsi:schemaLocation="urn:mace:shibboleth:2.0:metadata http://shibboleth.net/schema/idp/shibboleth-metadata.xsd
                        urn:oasis:names:tc:SAML:2.0:metadata http://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd"
 
+    resolveViaPredicatesOnly="true"
+    indexesRef="metadata.Indexes"
+    
 	id="inLineEntity" xsi:type="metadata:InlineMetadataProvider" sortKey="1">
 
 	<EntityDescriptor ID="ie1"
diff --git a/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd b/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
index 1bb3adf..cebc5cb 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
@@ -91,6 +91,22 @@
                         </annotation>
                     </element>
                 </choice>
+                <attribute name="indexesRef" type="string">
+                    <annotation>
+                        <documentation>
+                            ID of a Set of MetadataIndex instances used to support resolution of metadata based on
+                            criteria other than an entityID.
+                        </documentation>
+                    </annotation>
+                </attribute>
+                <attribute name="resolveViaPredicatesOnly" type="string">
+                    <annotation>
+                        <documentation>
+                            Flag indicating whether resolution may be performed solely by applying predicates to the
+                            entire metadata collection. Defaults to false.
+                        </documentation>
+                    </annotation>
+                </attribute>
             </extension>
         </complexContent>
     </complexType>

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


More information about the commits mailing list