[java-metadata-aggregator] branch master updated: MDA-220 - correctly handle whitelist of empty list of IDs
Ian Young
ian at iay.org.uk
Fri Sep 13 11:48:08 EDT 2019
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch master
in repository java-metadata-aggregator.
View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=22efa50d5ceceb63c87fb4bb2c26382c57b77e52
The following commit(s) were added to refs/heads/master by this push:
new 22efa50 MDA-220 - correctly handle whitelist of empty list of IDs
22efa50 is described below
commit 22efa50d5ceceb63c87fb4bb2c26382c57b77e52
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Fri Sep 13 16:48:01 2019 +0100
MDA-220 - correctly handle whitelist of empty list of IDs
https://issues.shibboleth.net/jira/browse/MDA-220
---
.../metadata/dom/saml/EntityFilterStage.java | 4 ---
.../metadata/dom/saml/EntityFilterStageTest.java | 32 ++++++++++++++++++++++
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java
index 4933da2..729d7f9 100644
--- a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java
+++ b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java
@@ -202,10 +202,6 @@ public class EntityFilterStage extends AbstractFilteringStage<Element> {
protected boolean processEntityDescriptor(@Nonnull final Element entityDescriptor) {
final String entityId = entityDescriptor.getAttributeNS(null, "entityID");
- if (designatedEntities.isEmpty()) {
- return false;
- }
-
// if we're whitelisting entities and this entity isn't in the list, kick it out
if (isWhitelistingEntities() && !designatedEntities.contains(entityId)) {
log.debug("{} pipeline stage removing entity {} because it wasn't on the whitelist", getId(), entityId);
diff --git a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/EntityFilterStageTest.java b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/EntityFilterStageTest.java
index a55cb20..aebd1fd 100644
--- a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/EntityFilterStageTest.java
+++ b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/EntityFilterStageTest.java
@@ -122,6 +122,38 @@ public class EntityFilterStageTest extends BaseDOMTest {
Assert.assertEquals(metadataCollection.size(), 1);
}
+ /**
+ * Test that whitelisting an empty set of IDs removes everything from the collection.
+ */
+ @Test public void testWhitelistEmptySet() throws Exception {
+ final var metadataCollection = buildMetadataCollection();
+
+ final var stage = new EntityFilterStage();
+ stage.setId("test");
+ stage.setWhitelistingEntities(true);
+ stage.setDesignatedEntities(Collections.emptySet());
+ stage.initialize();
+ stage.execute(metadataCollection);
+
+ Assert.assertEquals(metadataCollection.size(), 0);
+ }
+
+ /**
+ * Test that blacklisting an empty set of IDs leaves everything in the collection.
+ */
+ @Test public void testBlacklistEmptySet() throws Exception {
+ final var metadataCollection = buildMetadataCollection();
+
+ final var stage = new EntityFilterStage();
+ stage.setId("test");
+ stage.setWhitelistingEntities(false);
+ stage.setDesignatedEntities(Collections.emptySet());
+ stage.initialize();
+ stage.execute(metadataCollection);
+
+ Assert.assertEquals(metadataCollection.size(), 3);
+ }
+
/** Build up a metadata collection containing 3 EntityDescriptors. */
private Collection<Item<Element>> buildMetadataCollection() throws Exception {
final ArrayList<Item<Element>> metadataCollection = new ArrayList<>();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list