[java-identity-provider] 22/51: IDP-1121 Remove the explicit <SourceAttributes> from the <InputDataConnector>

Rod Widdowson rdw at steadingsoftware.com
Wed Feb 6 08:42:53 EST 2019


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

rdw 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=b2aa7d1911c9f711e8be2f8c7b1cf613f167d674

commit b2aa7d1911c9f711e8be2f8c7b1cf613f167d674
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jan 21 16:12:50 2019 +0000

    IDP-1121 Remove the explicit <SourceAttributes> from the <InputDataConnector>
    
    https://issues.shibboleth.net/jira/browse/IDP-1121
    
    No that attribute cannot have spaces in their name it has no purpose.
---
 .../spring/impl/InputDataConnectorParser.java      | 41 +++++-----------------
 .../resolver/spring/DependencyTypesTest.java       | 11 ------
 .../resolver/spring/inputDataConnector5.xml        |  8 -----
 .../schema/shibboleth-attribute-resolver.xsd       |  8 +----
 4 files changed, 9 insertions(+), 59 deletions(-)

diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/InputDataConnectorParser.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/InputDataConnectorParser.java
index 0aa2416..6907116 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/InputDataConnectorParser.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/InputDataConnectorParser.java
@@ -17,28 +17,24 @@
 
 package net.shibboleth.idp.attribute.resolver.spring.impl;
 
-import java.util.List;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.xml.namespace.QName;
 
-import net.shibboleth.ext.spring.util.SpringSupport;
-import net.shibboleth.idp.attribute.resolver.ResolverDataConnectorDependency;
-import net.shibboleth.idp.attribute.resolver.ResolverPluginDependency;
-import net.shibboleth.idp.attribute.resolver.spring.ResolverPluginDependencyParser;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import net.shibboleth.utilities.java.support.xml.ElementSupport;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.ManagedList;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 
+import net.shibboleth.ext.spring.util.SpringSupport;
+import net.shibboleth.idp.attribute.resolver.ResolverDataConnectorDependency;
+import net.shibboleth.idp.attribute.resolver.ResolverPluginDependency;
+import net.shibboleth.idp.attribute.resolver.spring.ResolverPluginDependencyParser;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
 /** Bean definition parser for a {@link ResolverPluginDependency}. */
 public class InputDataConnectorParser extends ResolverPluginDependencyParser {
 
@@ -46,10 +42,6 @@ public class InputDataConnectorParser extends ResolverPluginDependencyParser {
     @Nonnull public static final QName ELEMENT_NAME =
             new QName(AttributeResolverNamespaceHandler.NAMESPACE, "InputDataConnector");
 
-    /** Child Element Name. */
-    @Nonnull @Deprecated public static final QName SOURCE_ATTRIBUTES =
-            new QName(AttributeResolverNamespaceHandler.NAMESPACE, "SourceAttribute");
-
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(InputDataConnectorParser.class);
 
@@ -65,36 +57,19 @@ public class InputDataConnectorParser extends ResolverPluginDependencyParser {
         
         final Attr attributes = config.getAttributeNodeNS(null, "attributeNames");
         final String allAttributes = StringSupport.trimOrNull(config.getAttributeNS(null, "allAttributes"));
-        final List<Element> attributeElements = ElementSupport.getChildElements(config, SOURCE_ATTRIBUTES);
         if (attributes != null) {
             if (allAttributes != null) {
                 log.error("attributeNames and allAttributes are mutually exclusive");
                 throw new BeanCreationException(ELEMENT_NAME.getLocalPart()
                         + ": attributeNames and allAttributes are mutually exclusive");
             }
-            if (!attributeElements.isEmpty()) {
-                log.error("attributeNames and <SourceAttribute> are mutually exclusive");
-                throw new BeanCreationException(ELEMENT_NAME.getLocalPart()
-                        + ": attributeNames and child elements are mutually exclusive");
-            }
             builder.addPropertyValue("attributeNames", SpringSupport.getAttributeValueAsList(attributes));
         } else if (allAttributes != null) {
-            if (!attributeElements.isEmpty()) {
-                log.error("allAttributes and <SourceAttribute> are mutually exclusive");
-                throw new BeanCreationException(ELEMENT_NAME.getLocalPart()
-                        + ": attributeNames and allAttributes are mutually exclusive");
-            }
             builder.addPropertyValue("allAttributes", allAttributes);
-        } else if (!attributeElements.isEmpty()) {
-            final ManagedList<String> elementNameList = new ManagedList<>(attributeElements.size());
-            for (final Element el:attributeElements) {
-                elementNameList.add(el.getTextContent());
-            }
-            builder.addPropertyValue("attributeNames", elementNameList);
         } else {
-            log.error("One of attributeNames, allAttributes or <SourceAttribute>  must be specified");
+            log.error("One of attributeNames or allAttributes must be specified");
             throw new BeanCreationException(ELEMENT_NAME.getLocalPart()
-                    + ": One of attributeNames, allAttributes or <SourceAttribute> must be specified ");
+                    + ": One of attributeNames or allAttributes must be specified ");
         }
     }
     
diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/DependencyTypesTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/DependencyTypesTest.java
index e966c2c..21769e3 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/DependencyTypesTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/DependencyTypesTest.java
@@ -42,17 +42,6 @@ public class DependencyTypesTest extends BaseAttributeDefinitionParserTest {
         Assert.assertTrue(re.getAttributeNames().contains("3"));
     }
 
-    @Test public void elementList() {
-        final ResolverDataConnectorDependency re = getBean(BEAN_FILE_PATH + "inputDataConnector5.xml", ResolverDataConnectorDependency.class, new GenericApplicationContext());
-        
-        Assert.assertEquals(re.getDependencyPluginId(), "DC1");
-        Assert.assertFalse(re.isAllAttributes());
-        Assert.assertEquals(re.getAttributeNames().size(), 3);
-        Assert.assertTrue(re.getAttributeNames().contains("1"));
-        Assert.assertTrue(re.getAttributeNames().contains("2"));
-        Assert.assertTrue(re.getAttributeNames().contains("3"));
-    }
-
     @Test public void allAttributeDataConnector() {
         final ResolverDataConnectorDependency re = getBean(BEAN_FILE_PATH + "inputDataConnector2.xml", ResolverDataConnectorDependency.class, new GenericApplicationContext());
         
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/inputDataConnector5.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/inputDataConnector5.xml
deleted file mode 100644
index d829771..0000000
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/inputDataConnector5.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<InputDataConnector xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-                    xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd"
-    ref="DC1">
-	<SourceAttribute>1</SourceAttribute>
-	<SourceAttribute>2</SourceAttribute>
-	<SourceAttribute>3</SourceAttribute>
-</InputDataConnector>
diff --git a/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd b/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
index da919ee..11f610e 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
@@ -232,18 +232,12 @@
 
                 allAttributes means take all attributes. Property replacement done before conversion
 
-                the SourceAtttribute elementslist serves the same purpose but allows space.
-                Since spaces in attribute names are deprecated this is also deprecated
-
-                One one of the abovr are allowed.
+                One one of the above are allowed.
             </documentation>
         </annotation>
         <complexType>
             <complexContent>
                 <extension base="resolver:PluginDependencyType">
-                    <sequence  maxOccurs="unbounded" minOccurs="0">
-	                    <element name="SourceAttribute" type="string"/>
-	                </sequence>
                     <attribute name="allAttributes" type="string"/>
                     <attribute name="attributeNames" type="string"/>
                 </extension>

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


More information about the commits mailing list