[java-identity-provider] 01/02: IDP-1870: Detect duplicate entityIDs when ingesting metadata
Brent Putman
putmanb at georgetown.edu
Thu Dec 2 03:56:26 UTC 2021
This is an automated email from the git hooks/post-receive script.
putmanb pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=ddc8e6144b5ee098f9d323ddf827511b9035fcb9
commit ddc8e6144b5ee098f9d323ddf827511b9035fcb9
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Fri Nov 19 12:46:36 2021 -0500
IDP-1870: Detect duplicate entityIDs when ingesting metadata
Spring parser updates for new property on ChainingMetadataResolver.
---
.../relyingparty/metadata/impl/ChainingMetadataProviderParser.java | 6 ++++++
.../spring/relyingparty/metadata/ChainingMetadataParserTest.java | 5 +++++
.../shibboleth/idp/profile/spring/relyingparty/metadata/chain2.xml | 1 +
idp-schema/src/main/resources/schema/shibboleth-metadata.xsd | 7 +++++++
4 files changed, 19 insertions(+)
diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ChainingMetadataProviderParser.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ChainingMetadataProviderParser.java
index 415753505..060cfa6f9 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ChainingMetadataProviderParser.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ChainingMetadataProviderParser.java
@@ -21,6 +21,7 @@ import java.util.List;
import net.shibboleth.ext.spring.util.SpringSupport;
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.metadata.resolver.ChainingMetadataResolver;
@@ -48,5 +49,10 @@ public class ChainingMetadataProviderParser extends AbstractMetadataProviderPars
builder.addPropertyValue("resolvers",
SpringSupport.parseCustomElements(childProviders, parserContext, builder));
+
+ if (element.hasAttributeNS(null, "detectDuplicateEntityIDs")) {
+ builder.addPropertyValue("detectDuplicateEntityIDs",
+ StringSupport.trimOrNull(element.getAttributeNS(null, "detectDuplicateEntityIDs")));
+ }
}
}
diff --git a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/ChainingMetadataParserTest.java b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/ChainingMetadataParserTest.java
index 593af7b22..d56b9a7b3 100644
--- a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/ChainingMetadataParserTest.java
+++ b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/ChainingMetadataParserTest.java
@@ -23,6 +23,7 @@ import java.util.Iterator;
import net.shibboleth.utilities.java.support.resolver.ResolverException;
import org.opensaml.saml.metadata.resolver.ChainingMetadataResolver;
+import org.opensaml.saml.metadata.resolver.DetectDuplicateEntityIDs;
import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -34,6 +35,8 @@ public class ChainingMetadataParserTest extends AbstractMetadataParserTest {
ChainingMetadataResolver resolver = getBean(ChainingMetadataResolver.class, "chain.xml");
Assert.assertEquals(resolver.getId(), "chain");
+
+ Assert.assertEquals(resolver.getDetectDuplicateEntityIDs(), DetectDuplicateEntityIDs.Off);
final Iterator<EntityDescriptor> entities = resolver.resolve(criteriaFor(IDP_ID)).iterator();
@@ -49,6 +52,8 @@ public class ChainingMetadataParserTest extends AbstractMetadataParserTest {
Assert.assertEquals(resolver.getId(), "chain2");
+ Assert.assertEquals(resolver.getDetectDuplicateEntityIDs(), DetectDuplicateEntityIDs.Batch);
+
final Iterator<EntityDescriptor> entities = resolver.resolve(criteriaFor(IDP_ID)).iterator();
Assert.assertEquals(entities.next().getEntityID(), IDP_ID);
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/chain2.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/chain2.xml
index 0ea30442e..7ea04925c 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/chain2.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/chain2.xml
@@ -5,6 +5,7 @@
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"
+ detectDuplicateEntityIDs="Batch"
id="chain2" xsi:type="metadata:ChainingMetadataProvider">
<metadata:MetadataProvider id="entity"
diff --git a/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd b/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
index 6ee77b998..f7d8f3719 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
@@ -42,6 +42,13 @@
</annotation>
</element>
</sequence>
+ <attribute name="detectDuplicateEntityIDs" type="shibmd:string">
+ <annotation>
+ <documentation>
+ Strategy for detecting duplicate entityIDs across resolvers.
+ </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