[java-shib-attribute] branch main updated: IDP-2152 - DataConnector for metadata tags

Scott Cantor cantor.2 at osu.edu
Tue Aug 8 15:10:18 UTC 2023


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

scantor pushed a commit to branch main
in repository java-shib-attribute.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=0c9cb75faa1a17491c8e1ba1b98e1767385d26c6

The following commit(s) were added to refs/heads/main by this push:
     new 0c9cb75fa IDP-2152 - DataConnector for metadata tags
0c9cb75fa is described below

commit 0c9cb75faa1a17491c8e1ba1b98e1767385d26c6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Aug 8 11:10:15 2023 -0400

    IDP-2152 - DataConnector for metadata tags
    
    https://shibboleth.atlassian.net/browse/IDP-2152
    
    Parser unit test.
---
 .../EntityAttributesDataConnectorParserTest.java   | 47 ++++++++++++++++++++++
 .../idp/attribute/resolver/spring/customBean.xml   |  3 ++
 .../spring/dc/resolver/entityAttributes.xml        |  5 +++
 .../spring/dc/resolver/entityAttributesWithRef.xml |  6 +++
 4 files changed, 61 insertions(+)

diff --git a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/EntityAttributesDataConnectorParserTest.java b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/EntityAttributesDataConnectorParserTest.java
new file mode 100644
index 000000000..09865799f
--- /dev/null
+++ b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/EntityAttributesDataConnectorParserTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.attribute.resolver.spring.dc.impl;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.attribute.resolver.spring.testing.BaseAttributeDefinitionParserTest;
+import net.shibboleth.idp.saml.attribute.resolver.impl.EntityAttributesDataConnector;
+
+/**
+ * Test for {@link EntityAttributesDataConnectorParser}
+ */
+ at SuppressWarnings("javadoc")
+public class EntityAttributesDataConnectorParserTest extends BaseAttributeDefinitionParserTest {
+    
+    @Test public void simple() {
+        final EntityAttributesDataConnector connector = getDataConnector("resolver/entityAttributes.xml", EntityAttributesDataConnector.class);
+
+        assertEquals(connector.getExportAttributes().size(), 2);
+        assertTrue(connector.getExportAttributes().contains("foo"));
+        assertTrue(connector.getExportAttributes().contains("bar"));
+    }
+
+    @Test public void ref() {
+        final EntityAttributesDataConnector connector = getDataConnector("resolver/entityAttributesWithRef.xml", EntityAttributesDataConnector.class);
+
+        assertEquals(connector.getExportAttributes().size(), 2);
+        assertTrue(connector.getExportAttributes().contains("foo"));
+        assertTrue(connector.getExportAttributes().contains("bar"));
+    }
+
+}
\ No newline at end of file
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml
index 3c24c3553..682824a37 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml
@@ -76,6 +76,9 @@
     <bean id="shibboleth.HttpServletRequestSupplier"
         class="net.shibboleth.shared.servlet.impl.ThreadLocalHttpServletRequestSupplier"/>
     
+    <bean id="MetadataContextStrategy"
+        class="net.shibboleth.shared.logic.FunctionSupport" factory-method="constant" c:_0="#{null}" />
+    
 </beans>
 
        
\ No newline at end of file
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/entityAttributes.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/entityAttributes.xml
new file mode 100644
index 000000000..219322891
--- /dev/null
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/entityAttributes.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<DataConnector id="entityAttributes" xsi:type="EntityAttributes"
+    xmlns="urn:mace:shibboleth:2.0:resolver"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    exportAttributes="foo bar"
+	xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd" />
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/entityAttributesWithRef.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/entityAttributesWithRef.xml
new file mode 100644
index 000000000..af396fe61
--- /dev/null
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/entityAttributesWithRef.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<DataConnector id="entityAttributes" xsi:type="EntityAttributes"
+    xmlns="urn:mace:shibboleth:2.0:resolver"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    metadataContextStrategyRef="MetadataContextStrategy"
+    exportAttributes="foo bar"
+	xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd" />

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


More information about the commits mailing list