[java-identity-provider] 02/02: IDP-1235 Full stack test of preRequested Attributes with Activation Conditions

Rod Widdowson rdw at steadingsoftware.com
Wed Sep 25 06:36:33 EDT 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=1453a623acddd45c230286fbc35e67f2f690302c

commit 1453a623acddd45c230286fbc35e67f2f690302c
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Sep 25 11:35:13 2019 +0100

    IDP-1235 Full stack test of preRequested Attributes with Activation Conditions
    
    https://issues.shibboleth.net/jira/browse/IDP-1235
---
 .../resolver/spring/AttributeResolverTest.java     | 24 ++++++++++++++++++
 .../spring/attribute-resolver-preresolve2.xml      | 29 ++++++++++++++++++++++
 .../idp/attribute/resolver/spring/predicates.xml   | 27 +++++++++++++++++++-
 3 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java
index 1c25485..d695537 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java
@@ -430,6 +430,30 @@ public class AttributeResolverTest extends OpenSAMLInitBaseTestCase {
         assertEquals(postOnly.getValues().get(0).getDisplayValue(), "preOnly");
     }
 
+    @Test public void preResolve2() throws ResolutionException {
+        final GenericApplicationContext context = new GenericApplicationContext();
+        setTestContext(context);
+        context.setDisplayName("ApplicationContext: " + AttributeResolverTest.class);
+
+        final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
+                new SchemaTypeAwareXMLBeanDefinitionReader(context);
+
+        beanDefinitionReader.loadBeanDefinitions(new ClassPathResource(
+                "net/shibboleth/idp/attribute/resolver/spring/attribute-resolver-preresolve2.xml"),
+                new ClassPathResource("net/shibboleth/idp/attribute/resolver/spring/predicates.xml"));
+        context.refresh();
+
+        final AttributeResolver resolver = BaseAttributeDefinitionParserTest.getResolver(context);
+        AttributeResolutionContext resolutionContext =
+                TestSources.createResolutionContext("PETER", "issuer", "recipient");
+
+        resolver.resolveAttributes(resolutionContext);
+        assertEquals(resolutionContext.getResolvedIdPAttributes().size(), 1);
+        final IdPAttribute pre =  resolutionContext.getResolvedIdPAttributes().get("EPE");
+        assertEquals(pre.getValues().size(), 1);
+        assertEquals(pre.getValues().get(0).getDisplayValue(), "urn:org:example:attribute");
+    }
+
     @Test public void selectiveNavigate() throws ResolutionException {
         final GenericApplicationContext context = new GenericApplicationContext();
         setTestContext(context);
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/attribute-resolver-preresolve2.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/attribute-resolver-preresolve2.xml
new file mode 100644
index 0000000..c2b0491
--- /dev/null
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/attribute-resolver-preresolve2.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AttributeResolver 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">
+
+    <!-- ========================================== -->
+    <!--      Attribute Definitions                 -->
+    <!-- ========================================== -->
+
+    <AttributeDefinition xsi:type="Simple"
+        id="EPA1" preRequested="true" dependencyOnly="true">
+        <InputDataConnector ref="staticAttributes" attributeNames="staticEpA"/>
+    </AttributeDefinition>
+
+    <AttributeDefinition xsi:type="Simple"
+        id="EPE"
+        activationConditionRef="byAttr">
+        <InputDataConnector ref="staticAttributes" attributeNames="eduPersonEntitlement"/>
+    </AttributeDefinition>
+
+    <DataConnector id="staticAttributes"
+        xsi:type="Static">
+        <Attribute id="staticEpA">
+            <Value>member</Value>
+        </Attribute>
+        <Attribute id="eduPersonEntitlement">
+            <Value>urn:org:example:attribute</Value>
+        </Attribute>
+    </DataConnector>
+</AttributeResolver>
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/predicates.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/predicates.xml
index 75bdc11..b075b0b 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/predicates.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/predicates.xml
@@ -23,6 +23,31 @@
         c:candidates-ref="issuers" />
 
     <util:list id="recipients">
-    <value>https://example.org/sp</value>
+        <value>https://example.org/sp</value>
     </util:list>
+
+    <bean class="net.shibboleth.idp.profile.logic.SimpleAttributePredicate" id="byAttr" >
+        <property name="attributeValueMap">
+            <map>
+                <entry key="EPA1">
+                    <list>
+                        <value>*</value>
+                    </list>
+                </entry>
+            </map>
+        </property>
+        <property name="attributeContextLookupStrategy">
+            <bean id="shibboleth.Functions.Compose"
+                    class="net.shibboleth.utilities.java.support.logic.FunctionSupport" factory-method="compose">
+                <constructor-arg name="g">
+                    <bean id="shibboleth.ChildLookupOrCreate.AttributeContext"
+                        class="org.opensaml.messaging.context.navigate.ChildContextLookup"
+                        c:type="#{ T(net.shibboleth.idp.attribute.context.AttributeContext) }"/>
+                </constructor-arg>
+                <constructor-arg name="f">
+                    <bean class="org.opensaml.messaging.context.navigate.ChildContextLookup" c:type="#{ T(net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext) }" />
+                </constructor-arg>
+            </bean>
+        </property>
+     </bean>
 </beans>
\ No newline at end of file

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


More information about the commits mailing list