From 2c2dc09dbf864358ed85ce345911b076e8808087 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Fri, 11 Apr 2008 16:21:48 +0000 Subject: [PATCH] polish --- .../src/flow-definition-field-mappings.xml | 38 ++++----- .../src/flow-security.xml | 85 ++++++++++--------- spring-webflow-reference/src/portlet.xml | 22 ++--- spring-webflow-reference/src/spring-mvc.xml | 15 ++-- 4 files changed, 84 insertions(+), 76 deletions(-) diff --git a/spring-webflow-reference/src/flow-definition-field-mappings.xml b/spring-webflow-reference/src/flow-definition-field-mappings.xml index 6ca35e87..ffce8972 100644 --- a/spring-webflow-reference/src/flow-definition-field-mappings.xml +++ b/spring-webflow-reference/src/flow-definition-field-mappings.xml @@ -3,7 +3,7 @@ Flow Definition Language 1.0 to 2.0 Mappings The flow definition language has changed since the 1.0 release. - This is a listing of the language elements in the 1.0 release, and how they convert to element in the 2.0 release. + This is a listing of the language elements in the 1.0 release, and how they map to elements in the 2.0 release. While most of the changes are semantic, there are a few structural changes. Please see the upgrade guide for more details about changes between Web Flow 1.0 and 2.0. @@ -39,7 +39,7 @@ * - use evaluate + use <evaluate /> @@ -102,7 +102,7 @@ * - arguments can be used in evaluate + use <evaluate expression="func(arg1, arg2, ...)"/> @@ -159,7 +159,7 @@ * - input/output can be in flow/subflow directly + input and output elements can be in flows or subflows directly @@ -170,7 +170,7 @@ * - now subflow-state subflow-attribute-mapper + now subflow-attribute-mapper attribute on subflow-state @@ -183,7 +183,7 @@ * - use evaluate + use <evaluate /> @@ -324,7 +324,7 @@ * - use attribute name=”name” + use <evaluate ...> <attribute name=”name” value="..." /> </evaluate> @@ -353,7 +353,7 @@ * - use result attribute on evaluate + use <evaluate result="..." /> @@ -506,7 +506,7 @@ * - convert to top level flow + convert to new top-level flow @@ -543,7 +543,7 @@ * - prefix name with scope, ie flowScope.foo + prefix name with scope <input name="flowScope.foo" /> @@ -580,7 +580,7 @@ * - input can be in flow/subflow directly + inputs can be in flows and subflows directly @@ -663,7 +663,7 @@ * - use evaluate + use <evaluate expression="func(arg1, arg2, ...)"/> @@ -676,7 +676,7 @@ * - use evaluate + use <evaluate result="..." /> @@ -721,7 +721,7 @@ * - prefix name with scope, ie flowScope.foo + prefix name with scope <output name="flowScope.foo" /> @@ -758,7 +758,7 @@ * - output can be in flow/subflow directly + output can be in flows and subflows directly @@ -797,7 +797,7 @@ * - prefix name with scope, ie flowScope.foo + prefix name with scope <set name="flowScope.foo" /> @@ -816,7 +816,7 @@ * - use attribute name=”name” + use <set ...> <attribute name=”name” value="..." /> </set> @@ -847,7 +847,7 @@ * - now attribute on flow, or implicit + now <flow start-state="...">, or defaults to the first state in the flow @@ -997,7 +997,7 @@ * - no longer supported + all Spring beans can be resolved with EL diff --git a/spring-webflow-reference/src/flow-security.xml b/spring-webflow-reference/src/flow-security.xml index f8b8d0a2..1b3033e0 100644 --- a/spring-webflow-reference/src/flow-security.xml +++ b/spring-webflow-reference/src/flow-security.xml @@ -5,8 +5,8 @@ Introduction Security is an important concept for any application. - End users should not be able to access any portion of your site simply by guessing the URL. - Areas of a site that are sensitive should insure that only authorized requested are processed. + End users should not be able to access any portion of a site simply by guessing the URL. + Areas of a site that are sensitive must insure that only authorized requested are processed. Spring Security is a proven security platform that can integrate with your application at multiple levels. This section will focus on securing flow execution. @@ -16,7 +16,7 @@ Securing flow execution is a three step process: - Configure Spring Security with allowed users and roles + Configure Spring Security with authentication and authorization rules Annotate the flow definition with the secured element to define the security rules Add the SecurityFlowExecutionListener to process the security rules. @@ -28,25 +28,25 @@ The secured element - The secured element designates that its containing element should apply the authorization checks before fully entering. - This element is optional and should occur only once per stage of the flow execution that is secured. + The secured element designates that its containing element should apply the authorization check before fully entering. + This may not occur more then once per stage of the flow execution that is secured. - There are three phases of flow execution that can be secured: flows, states and transitions. + Three phases of flow execution can be secured: flows, states and transitions. In each case the syntax for the secured element is identical. Security attributes - The attributes attribute is a comma separated list of Spring Security attributes. - Often these are specific security roles. - These attributes will be compared against the user's granted attributes by a Spring Security access decision manager. + The attributes attribute is a comma separated list of Spring Security authorization attributes. + Often, these are specific security roles. + The attributes are compared against the user's granted attributes by a Spring Security access decision manager. <secured attributes="ROLE_USER" /> - By default a role based access decision manager is used to determine if the user is allowed access. + By default, a role based access decision manager is used to determine if the user is allowed access. This will need to be overridden if your application is not using authorization roles. @@ -54,14 +54,15 @@ Matching type There are two types of matching available: any and all. - Any will allow access if at least one of the required security attributes is granted to the user. - All allows access only if each of the required security attributes are granted to the user. + Any, allows access if at least one of the required security attributes is granted to the user. + All, allows access only if each of the required security attributes are granted to the user. <secured attributes="ROLE_USER, ROLE_ANONYMOUS" match="any" /> - The default value is any. + This attribute is optional. + If not defined, the default value is any. The match attribute will only be respected if the default access decision manager is used. @@ -71,43 +72,48 @@ The SecurityFlowExecutionListener - Defining security rules in your flow by itself will not protect the flow execution. + Defining security rules in the flow by themself will not protect the flow execution. A SecurityFlowExecutionListener must also be defined in the webflow configuration and applied to the flow executor. - -<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"> - <webflow:flow-execution-listeners> - <webflow:listener ref="securityFlowExecutionListener" /> - </webflow:flow-execution-listeners> -</webflow:flow-executor> + + + + + -<bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener" /> - - - If your application is using authorities that are not role based, you will need to configure a custom AccessDecisionManager. - You can override the default decision manager by setting the accessDecisionManager property on the security listener. - Please consult the Spring Security documentation to learn more about decision managers. - - -<bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener"> - <property name="accessDecisionManager" ref="myCustomAccessDecisionManager" /> -</bean> - + + ]]> If access is denied to a portion of the application an AccessDeniedException will be thrown. This exception will later be caught by Spring Security and used to prompt the user to authenticate. It is important that this exception be allowed to travel up the execution stack uninhibited, otherwise the end user may not be prompted to authenticate. + + Custom Access Decision Managers + + If your application is using authorities that are not role based, you will need to configure a custom AccessDecisionManager. + You can override the default decision manager by setting the accessDecisionManager property on the security listener. + Please consult the Spring Security reference documentation to learn more about decision managers. + + + + + ]]> + Configuring Spring Security Spring Security has robust configuration options available. - As every application and environment has its own security requirements, the Spring Security reference guide is the best place to learn about all of the available options. + As every application and environment has its own security requirements, the Spring Security reference documentation is the best place to learn the available options. Both the booking-faces and booking-mvc sample applications are configured to use Spring Security. - Spring Security needs to be configured for both the Spring configuration and the web.xml level. + Configuration is needed at both the Spring and web.xml levels. Spring configuration @@ -149,15 +155,16 @@ <filter> - <filter-name>springSecurityFilterChain</filter-name> - <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> + <filter-name>springSecurityFilterChain</filter-name> + <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> - <filter-name>springSecurityFilterChain</filter-name> - <url-pattern>/*</url-pattern> + <filter-name>springSecurityFilterChain</filter-name> + <url-pattern>/*</url-pattern> </filter-mapping> - \ No newline at end of file + +s \ No newline at end of file diff --git a/spring-webflow-reference/src/portlet.xml b/spring-webflow-reference/src/portlet.xml index cd76d6e0..5ee44c14 100644 --- a/spring-webflow-reference/src/portlet.xml +++ b/spring-webflow-reference/src/portlet.xml @@ -4,7 +4,7 @@ Introduction - This chapter shows you how to use Web Flow in a Portlet environment. + This chapter shows how to use Web Flow in a Portlet environment. Web Flow has full support for JSR-168 portlets. The booking-portlet-mvc sample application is a good reference for using Web Flow within a portlet. This application is a simplified travel site that allows users to search for and book hotel rooms. @@ -14,10 +14,10 @@ Configuring web.xml & portlet.xml The configuration for a portlet depends on the portlet container used. - The booking-portlet-mvc and booking-portlet-faces sample application are both configured to use Apache Pluto, the JSR-168 reference implementation. + The sample applications, included with Web Flow, are both configured to use Apache Pluto, the JSR-168 reference implementation. - In general the configuration requires adding a servlet mapping in the web.xml file to dispatch request to the portlet container. + In general, the configuration requires adding a servlet mapping in the web.xml file to dispatch request to the portlet container. @@ -62,7 +62,7 @@ Flow Handlers - The only supported mechanism for bridging a portlet request to Web Flow is via a FlowHandler. + The only supported mechanism for bridging a portlet request to Web Flow is a FlowHandler. The PortletFlowController used in Web Flow 1.0 is no longer supported. @@ -78,9 +78,11 @@ handle the flow execution outcome - handle any exceptions + handle exceptions + + The AbstractFlowHandler class is an implementation of FlowHandler that provides default implementations for these hooks. @@ -98,7 +100,7 @@ public class ViewFlowHandler extends AbstractFlowHandler { Adapter Mappings Spring Portlet MVC provides a rich set of methods to map portlet requests. - Complete documentation of the available methods is available in the Spring Reference Documentation. + Complete documentation is available in the Spring Reference Documentation. The booking-portlet-mvc sample application uses a PortletModeHandlerMapping to map portlet requests. @@ -132,13 +134,13 @@ public class ViewFlowHandler extends AbstractFlowHandler { Redirect on Pause - In a portlet environemnt, alwaysRedirectOnPause must be set to false. + In a portlet environemnt, always-redirect-on-pause must be set to false. If not turned off, the initial view will fail to render. - + ]]> @@ -209,7 +211,7 @@ ${externalContext.requestMap.portletMode} Even if the mode is mapped to a different FlowHandler the flow execution will resume the previous execution. - One way to start the new flow is to create a URL targeting the mode without the execution key. + One way to start a new flow is to create a URL targeting the mode without the execution key. @@ -218,7 +220,7 @@ ${externalContext.requestMap.portletMode} Web Flow supports JSF as the view technology for a portlet. However, a jsf-portlet bridge (JSR-301) must be provided. At the time of this writing, no feature complete jsf-portlet bridge exists. - Some of the existing bridge implementations may appear to work, however, strange side effect may occur. + Some of the existing bridge implementations may appear to work, however, side effect may occur. JSF portlets are considered experimental at this time. diff --git a/spring-webflow-reference/src/spring-mvc.xml b/spring-webflow-reference/src/spring-mvc.xml index e2ccfea7..36e7305e 100644 --- a/spring-webflow-reference/src/spring-mvc.xml +++ b/spring-webflow-reference/src/spring-mvc.xml @@ -4,7 +4,7 @@ Introduction - This chapter shows you how to integrate Web Flow into a Spring MVC web application. + This chapter shows how to integrate Web Flow into a Spring MVC web application. The booking-mvc sample application is a good reference for Spring MVC with Web Flow. This application is a simplified travel site that allows users to search for and book hotel rooms. @@ -14,9 +14,8 @@ The first step to using Spring MVC is to route requests to the DispatcherServlet in the web.xml file. In this example, we map all URLs that begin with /spring/ to the servlet. - The servlet needs to be configured. - An init-param is used in the servlet to pass the contextConfigLocation. - This is the location of the Spring configuration for your application. + An init-param is used to pass the contextConfigLocation. + This is the location of the Spring configuration for the application. @@ -41,7 +40,7 @@ URL Mapping Inside the DispatcherServlet request need to be mapped with finer grain. - Using a SimpleUrlHandlerMapping request URLs are mapped to controllers and handlers. + Using a SimpleUrlHandlerMapping, request URLs are mapped to controllers and handlers. @@ -54,7 +53,7 @@ ]]> - For this example both a standard MVC controller and a Web Flow handler are configured. + In this example both a standard MVC controller and a Web Flow handler are configured. The hotelsController supports the free navigation aspects of searching and viewing hotels. The bookingFlowHandler supports the controlled navigation aspect of booking a hotel room. @@ -63,7 +62,7 @@ Flow Controllers Flow controllers provide a basic hook from Spring MVC into Web Flow. - The FlowController class is an implementation of an MVC Controller. + The FlowController class is an implementation of MVC's Controller interface. @@ -91,7 +90,7 @@ handle the flow execution outcome - handle any exceptions + handle exceptions