Issue Details (XML | Word | Printable)

Key: SWF-93
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Scott Andrews
Reporter: Keith Donald
Votes: 16
Watchers: 19
Operations

If you were logged in you would be able to see more operations.
Spring Web Flow

Add support for securing flows

Created: 22/Mar/06 07:02 PM   Updated: 29/Feb/08 05:08 PM
Component/s: Integration: Security
Affects Version/s: 1.0.4
Fix Version/s: 2.0 M4

Time Tracking:
Original Estimate: 4d
Original Estimate - 4d
Remaining Estimate: 4d
Remaining Estimate - 4d
Time Spent: Not Specified
Remaining Estimate - 4d

File Attachments: 1. Zip Archive flow-security-interceptor.zip (14 kB)
2. Zip Archive spring-webflow-security.zip (14 kB)

Issue Links:
Depends
 


 Description  « Hide
Support that builds on the flow execution listener infrastructure to secure flows. Should integrate a security framework such as Acegi.

 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
Alef Arendsen added a comment - 25/Jan/07 11:14 AM
A client of ours has prototyped this recently. Today I spent a while refactoring what they have and it's okay for us to use their solution, incorporating it in WebFlow.

It does exactly what you describe and integrates with Acegi to provide flow-level security, but also more fine-grained control such as security based on state-transitions and events. My guess is this functionality will be used less often, but it certainly is nice.

Anyway, stay tuned!

Alef Arendsen added a comment - 09/Feb/07 05:20 AM
Added flow security interceptor, much in the same way as the MethodSecurityInterceptor. Works using the same concepts (ObjectDefinitionSource implementation specific for WebFlow flows, states and events).

Configuration as follows:

<bean class="....FowSecurityInterceptor">
  <property name="flowDefinitionSource">
    <value>
        FLOW_ID.state.STATE_ID=authority1
        FLOW_ID=authority1,authority2
        FLOW_ID.event.EVENT_ID=authority1
    </value>
  </property>
</bean>

Keith Donald added a comment - 17/May/07 10:16 AM
Ideas for flow-level security constraints defined with the flow definition itself:

Flow security:

<flow>
    <attribute name="requiredAuthorities" value="LOGGED_IN,CHANGE_PASSWORD"/>
     
    ....
</flow>

State security:

<flow>
    <start-state idref="whatev">

    <view-state id="whatev" view="form.jsp">
        <attribute name="requiredAuthorities" value="LOGGED_IN,CHANGE_PASSWORD"/>
    </view-state>
     
    ....
</flow>

Marten Deinum added a comment - 07/Jun/07 05:00 PM
We use the event based security quite a lot, so you would have to add it to transitions as well!

<flow>
   <view-state id="whatev" view="form.jsp"/>
       <transition on="someEvent" to="bla">
            <attribute name="requiredAuthorities" value="LOGGED_IN,CHANGE_PASSWORD"/>
</flow>

However what I like about the current solution is that it is quite non-intrusive, it is simply a matter of configuration. Also we tend to have most of our security-configuration stuff inside 1 xml file. So we have 1 file defining our method, url and flow security. Now the security would be scattered around in the different flow definitions.

Marten Deinum added a comment - 13/Jun/07 09:16 AM
For a presentation I created a demo for this demo I made some minor improvements in the initial code I also removed the JDK 1.5 constructs to be compatible again with jdk 1.3 and up. I also made it a maven2 project so building it and installing it in a local repository should be a breeze :).

Keith Garry Boyce added a comment - 18/Oct/07 04:54 PM
Suppose I wanted to protect an event on a state. With this solution how do I do that?

Cihan Aksakal added a comment - 10/Dec/07 09:56 AM - edited
Does anybody know whether this patch of Keith will be integrated in Acegi or Spring?

I wrote a version of this interceptor using static flowDefinitions (plain type) and regular expressions. If anybody is interested in I would share it with the community - but first I have to make a code review ;)

Example configuration:

   <bean id="flowSecurityInterceptor"
                class="org.springframework.webflow.security.ExtendedFlowSecurityInterceptor">
      <property name="authenticationManager">
         <ref bean="authenticationManager" />
      </property>
      <property name="accessDecisionManager">
         <ref bean="accessDecisionManager" />
      </property>
      <property name="flowDefinitionSource">
         <value>
            <!--
                  NOTE: if there is a plain definition for a flow, a matching against regex definitions will not be performed
            -->
            <!-- you have to be authenticated as ROLE_CALLER for all flows except for the flows authenticate, startPortal and defaultFlow -->
            authenticate=ROLE_ANONYMOUS
            startPortal=ROLE_ANONYMOUS
            defaultFlow=ROLE_ANONYMOUS
            regex@.*=ROLE_CALLER
         </value>
      </property>
   </bean>
<!--
NOTE : if type is not defined, plain@ is set as default
   examples :
         flowId=ROLE_USER
         flowId.event.eventId=ROLE_USER
         flowId.event.eventId=ROLE_USER
         plain@flowId=ROLE_USER
         plain@flowId.event.eventId=ROLE_USER
         plain@flowId.state.stateId=ROLE_USER
         regex@.*=ROLE_USER
         regex@flowId.event..*=ROLE_USER
         regex@flowId.state..*=ROLE_USER
   not supported :
         regex@.*.event..*=ROLE_USER
         regex@.*.state..*=ROLE_USER
-->

Scott Andrews added a comment - 28/Feb/08 09:03 AM
Working to add integration with Spring Security based on a SecurityFlowExecutionListener and the new <secured /> entity, SWF-486.

Scott Andrews added a comment - 29/Feb/08 05:08 PM
Implemented Spring Security integration via org.springframework.webflow.security.SecurityFlowExecutionListener. Listens on sessionCreating, stateEntering and transitionExecuting events. Looks at 'secured' attribute for org.springframework.webflow.security.SecurityRule and checks if authorized. If not authorized, throws AccessDeniedException exception.