Announcement Announcement Module
Collapse
No announcement yet.
Upgrading from 3.0 to 3.1 fails with the new WebExpressionVoter (FilterInvocation) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upgrading from 3.0 to 3.1 fails with the new WebExpressionVoter (FilterInvocation)

    Hi guys

    I'm in the process of upgrading from 3.0 to 3.1 and is having some issues with WebExpressionVoter.

    Basically, what I have done so far is:
    1) Upgrade version to 3.1.0.RELEASE in pom.xml
    2) Updated namespaces to 3.1
    3) Moved all intercept-url with filters="none" out of the old <http /> and into new <http pattern="" security="none" />
    4) Changed property on UnanimousBased to be constructor-arg instead (was deprecated)
    5) Updated all custom voters to use Object as generic parameter

    And this now compiles fine with no warnings. My issue is that I'm using SpEL together with custom voters, and since WebExpressionVoter now demands a FilterInvocation as the object, it fails since the object passed around is actually a ActionConfig (struts2) object.

    This was working fine with 3.0, but because of the generic AccessDecisionVoter in 3.1, this is no longer the case, and since UnanimousBased (which I am using) demands that all voters say yes (without checking if the voter supports the type) this of course fails...

    So I'm wondering what the upgrade path is here?

    My voter config looks like this:

    Code:
      <bean id="regularAccessDecisionVoting" class="org.springframework.security.access.vote.UnanimousBased">
        <constructor-arg name="decisionVoters">
          <list>
            <ref local="actionAccessVoter" />
            <ref local="moduleAccessVoter" />
            <ref local="authenticatedVoter" />
            <ref local="webExpressionVoter" />
          </list>
        </constructor-arg>
      </bean>
    Any suggestions?

    Regards,
    Morten

  • #2
    Anyone?

    The exception that is throw, is this:
    java.lang.ClassCastException: com.opensymphony.xwork2.config.entities.ActionConf ig cannot be cast to org.springframework.security.web.FilterInvocation

    Which makes sense.. but this was working fine in 3.0, anyone else using struts 2 and spring security have this issue? or have hints on to where i can start debugging?

    Update: Moving webExpressionVoter out of the block, and creating a webAccessDecisionVoting which was then added to the list of accessDecisionManagers in my accessDecisionManager seems to do the trick. Still feels weird that it gave me a class cast exception.. that it ever got to that point... since the class obviously does not support the object passed around.

    Regards,
    Morten
    Last edited by mortenoh; Mar 5th, 2012, 09:42 AM.

    Comment

    Working...
    X