[java-identity-provider COMMIT] in /trunk: idp-conf/src/main/resources/system/conf/webflow-config.xml idp-profile-spr...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jul 19 14:34:30 EDT 2016


Author: scantor
Date: Tue Jul 19 14:34:30 2016
New Revision: 8299

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8299&view=rev
Log:
IDP-966 - Provide a mechanism for adding webflows programmatically

https://issues.shibboleth.net/jira/browse/IDP-966

Enhance resource factory implementation to accomodate our use cases.

Modified:
    trunk/idp-conf/src/main/resources/system/conf/webflow-config.xml
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionRegistryFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionResourceFactory.java

Modified: trunk/idp-conf/src/main/resources/system/conf/webflow-config.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/conf/webflow-config.xml?rev=8299&r1=8298&r2=8299&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/system/conf/webflow-config.xml	(original)
+++ trunk/idp-conf/src/main/resources/system/conf/webflow-config.xml	Tue Jul 19 14:34:30 2016
@@ -141,11 +141,15 @@
         </property>
     </bean>
     
-    <!-- Default flow patterns. -->
+    <!-- Default flow patterns with null values signifying use of the basePath on the registry to compute flow IDs. -->
     <bean id="shibboleth.DefaultFlowPatterns" lazy-init="true"
-        class="org.springframework.beans.factory.config.ListFactoryBean">
-        <property name="sourceList">
-            <value>/**/*-flow.xml</value>
+        class="org.springframework.beans.factory.config.MapFactoryBean">
+        <property name="sourceMap">
+            <map>
+                <entry key="/**/*-flow.xml">
+                    <null/>
+                </entry>
+            </map>
         </property>
     </bean>
     

Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionRegistryFactoryBean.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionRegistryFactoryBean.java?rev=8299&r1=8298&r2=8299&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionRegistryFactoryBean.java	(original)
+++ trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionRegistryFactoryBean.java	Tue Jul 19 14:34:30 2016
@@ -26,6 +26,8 @@
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.config.AbstractFactoryBean;
 import org.springframework.webflow.config.FlowDefinitionResource;
 import org.springframework.webflow.core.collection.LocalAttributeMap;
@@ -58,11 +60,14 @@
  */
 public class FlowDefinitionRegistryFactoryBean extends AbstractFactoryBean<FlowDefinitionRegistry> {
 
-    /** Explicit flow mappings. */
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(FlowDefinitionRegistryFactoryBean.class);
+
+    /** Explicit flow mappings from flow ID to resource path. */
     @Nonnull @NonnullElements private Map<String,String> flowLocations;
 
-    /** Pattern-based flow mappings. */
-    @Nonnull @NonnullElements private Collection<String> flowLocationPatterns;
+    /** Pattern-based flow mappings from pattern to base location to apply. */
+    @Nonnull @NonnullElements private Map<String,String> flowLocationPatterns;
 
     /** Required collaborator. */
     @Nullable private FlowBuilderServices flowBuilderServices;
@@ -79,7 +84,7 @@
     /** Constructor. */
     public FlowDefinitionRegistryFactoryBean() {
         flowLocations = Collections.emptyMap();
-        flowLocationPatterns = Collections.emptyList();
+        flowLocationPatterns = Collections.emptyMap();
     }
 
     /** {@inheritDoc} */
@@ -103,16 +108,32 @@
      * @param locationMap mappings from flow ID to resource
      */
     public void setFlowLocations(@Nonnull @NonnullElements final Map<String,String> locationMap) {
-        flowLocations = new LinkedHashMap(Constraint.isNotNull(locationMap, "Flow mappings cannot be null"));
-    }
-
-    /**
-     * Registers a set of flows resolved from a resource location pattern.
-     * 
-     * @param patterns the patterns to use
-     */
-    public void setFlowLocationPatterns(@Nonnull final Collection<String> patterns) {
-        flowLocationPatterns = StringSupport.normalizeStringCollection(patterns);
+        Constraint.isNotNull(locationMap, "Flow mappings cannot be null");
+        
+        flowLocations = new LinkedHashMap(locationMap.size());
+        for (final Map.Entry<String,String> entry : locationMap.entrySet()) {
+            if (entry.getKey() != null && entry.getValue() != null) {
+                flowLocations.put(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+
+    /**

[... 338 lines stripped ...]


More information about the commits mailing list