[java-identity-provider COMMIT] in /trunk: idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/r...

noreply at shibboleth.net noreply at shibboleth.net
Wed May 7 12:19:40 EDT 2014


Author: rdw
Date: Wed May  7 12:19:39 2014
New Revision: 5870

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5870&view=rev
Log:
IDP-280 Selective resolution plugin configuration.  Add context navigation configuration for non usual location of Profile Context.

Added:
    trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/attribute-resolver-selective-navigate.xml   (with props)
    trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/predicates-navigate.xml   (with props)
Modified:
    trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java
    trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java
    trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/predicates.xml
    trunk/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd

Modified: trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java?rev=5870&r1=5869&r2=5870&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java (original)
+++ trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java Wed May  7 12:19:39 2014
@@ -51,8 +51,7 @@
     }
 
     /** {@inheritDoc} */
-    @Override
-    protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
+    @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
             @Nonnull final BeanDefinitionBuilder builder) {
         super.doParse(config, parserContext, builder);
         String id = StringSupport.trimOrNull(config.getAttributeNS(null, "id"));
@@ -63,9 +62,14 @@
         }
         builder.setInitMethodName("initialize");
         builder.setDestroyMethodName("destroy");
-        
+
         if (config.hasAttributeNS(null, "activationPredicateRef")) {
             builder.addPropertyReference("activationCriteria", config.getAttributeNS(null, "activationPredicateRef"));
+        }
+
+        if (config.hasAttributeNS(null, "profileContextStrategy")) {
+            builder.addPropertyReference("profileContextStrategy",
+                    config.getAttributeNS(null, "profileContextStrategy"));
         }
 
         List<Element> dependencyElements =

Modified: trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java?rev=5870&r1=5869&r2=5870&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java (original)
+++ trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverTest.java Wed May  7 12:19:39 2014
@@ -332,6 +332,45 @@
         Assert.assertTrue(resolutionContext.getResolvedIdPAttributes().isEmpty());
     }
     
+    @Test public void selectiveNavigate() throws ResolutionException {
+        GenericApplicationContext context = new GenericApplicationContext();
+        context.setDisplayName("ApplicationContext: " + AttributeResolverTest.class);
+
+        SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
+                new SchemaTypeAwareXMLBeanDefinitionReader(context);
+
+        beanDefinitionReader.loadBeanDefinitions(new ClassPathResource(
+                "net/shibboleth/idp/attribute/resolver/spring/attribute-resolver-selective-navigate.xml"),
+                new ClassPathResource("net/shibboleth/idp/attribute/resolver/spring/predicates-navigate.xml"));
+        context.refresh();
+
+        final AttributeResolver resolver = context.getBean(AttributeResolver.class);
+        AttributeResolutionContext resolutionContext =
+                TestSources.createResolutionContext("PETER", "issuer", "recipient");
+        resolver.resolveAttributes(resolutionContext);
+        // this should fail since navigation failed.
+        Assert.assertEquals(resolutionContext.getResolvedIdPAttributes().size(), 0);
+
+        resolutionContext =
+                TestSources.createResolutionContext("PETER", "issuer", "recipient");
+        // add a child so we can navigate via that
+        resolutionContext.getSubcontext(ProfileRequestContext.class, true);

[... 52 lines stripped ...]


More information about the commits mailing list