[java-opensaml] branch master updated: Fix outstanding API issue in EntityAttributes interface.
Scott Cantor
cantor.2 at osu.edu
Wed Jul 17 13:12:04 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=b6a2d2ae648ffca328675bce4364506461401b97
The following commit(s) were added to refs/heads/master by this push:
new b6a2d2a Fix outstanding API issue in EntityAttributes interface.
b6a2d2a is described below
commit b6a2d2ae648ffca328675bce4364506461401b97
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jul 17 13:11:58 2019 -0400
Fix outstanding API issue in EntityAttributes interface.
---
.../saml/ext/saml2mdattr/EntityAttributes.java | 15 +++++++++++---
.../ext/saml2mdattr/impl/EntityAttributesImpl.java | 10 +---------
.../filter/impl/EntityAttributesFilter.java | 23 +++++++++-------------
3 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/ext/saml2mdattr/EntityAttributes.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/ext/saml2mdattr/EntityAttributes.java
index 784bce9..49a02e4 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/ext/saml2mdattr/EntityAttributes.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/ext/saml2mdattr/EntityAttributes.java
@@ -42,14 +42,21 @@ public interface EntityAttributes extends SAMLObject {
/** QName of the XSI type. */
public static final QName TYPE_NAME =
new QName(SAMLConstants.SAML20MDATTR_NS, TYPE_LOCAL_NAME, SAMLConstants.SAML20MDATTR_PREFIX);
-
- /* TODO: add a modifiable accessor of the child collection in 4.0
- public List<? extends SAMLObject> getEntityAttributesChildren();
+
+ /**
+ * Gets a fully mutable list of the child objects of this extension.
+ *
+ * @return mutable list of children
+ *
+ * @since 4.0.0
*/
+ public List<? extends SAMLObject> getEntityAttributesChildren();
/**
* Gets the attributes about the entity.
*
+ * <p>This list is modifiable "to a point" but not all mutation operations are supported.</p>
+ *
* @return attributes about the entity
*/
public List<Attribute> getAttributes();
@@ -57,6 +64,8 @@ public interface EntityAttributes extends SAMLObject {
/**
* Gets the assertions about the entity.
*
+ * <p>This list is modifiable "to a point" but not all mutation operations are supported.</p>
+ *
* @return assertions about the entity
*/
public List<Assertion> getAssertions();
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2mdattr/impl/EntityAttributesImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2mdattr/impl/EntityAttributesImpl.java
index d6ce632..1fa6888 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2mdattr/impl/EntityAttributesImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2mdattr/impl/EntityAttributesImpl.java
@@ -58,15 +58,7 @@ public class EntityAttributesImpl extends AbstractXMLObject implements EntityAtt
return (List<Assertion>) attributeInfo.subList(Assertion.DEFAULT_ELEMENT_NAME);
}
- /**
- * Get the list of {@link Attribute} and {@link Assertion} content.
- *
- * TODO: this is implementation only until 4.0 when we can promote this to the API
- *
- * @return a modifiable list of the children
- *
- * @since 3.4.0
- */
+ /** {@inheritDoc} */
public List<? extends SAMLObject> getEntityAttributesChildren() {
return attributeInfo;
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/filter/impl/EntityAttributesFilter.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/filter/impl/EntityAttributesFilter.java
index ed1db75..d6c758a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/filter/impl/EntityAttributesFilter.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/filter/impl/EntityAttributesFilter.java
@@ -40,7 +40,6 @@ import org.opensaml.core.xml.util.XMLObjectSupport;
import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.common.SAMLObjectBuilder;
import org.opensaml.saml.ext.saml2mdattr.EntityAttributes;
-import org.opensaml.saml.ext.saml2mdattr.impl.EntityAttributesImpl;
import org.opensaml.saml.metadata.resolver.filter.FilterException;
import org.opensaml.saml.metadata.resolver.filter.MetadataFilter;
import org.opensaml.saml.saml2.core.Attribute;
@@ -214,19 +213,15 @@ public class EntityAttributesFilter extends AbstractInitializableComponent imple
if (!entityAttributesCollection.isEmpty()) {
final EntityAttributes entityAttributes =
(EntityAttributes) entityAttributesCollection.iterator().next();
- if (entityAttributes instanceof EntityAttributesImpl) {
- // TODO: bug in original interface requires that we dive into the impl layer
- final List<? extends SAMLObject> attributes =
- ((EntityAttributesImpl) entityAttributes).getEntityAttributesChildren();
- final Iterator<? extends SAMLObject> iter = attributes.iterator();
- while (iter.hasNext()) {
- final SAMLObject attribute = iter.next();
- if (attribute instanceof Attribute) {
- if (!attributeFilter.test((Attribute) attribute)) {
- log.warn("Filtering pre-existing attribute '{}' from entity '{}'",
- ((Attribute) attribute).getName(), descriptor.getEntityID());
- iter.remove();
- }
+ final List<? extends SAMLObject> attributes = entityAttributes.getEntityAttributesChildren();
+ final Iterator<? extends SAMLObject> iter = attributes.iterator();
+ while (iter.hasNext()) {
+ final SAMLObject attribute = iter.next();
+ if (attribute instanceof Attribute) {
+ if (!attributeFilter.test((Attribute) attribute)) {
+ log.warn("Filtering pre-existing attribute '{}' from entity '{}'",
+ ((Attribute) attribute).getName(), descriptor.getEntityID());
+ iter.remove();
}
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list