【问题标题】:Spring webflow + CAS : AuthenticationViaFormAction class is not calledSpring webflow + CAS:不调用AuthenticationViaFormAction类
【发布时间】:2015-08-06 22:55:53
【问题描述】:

我的应用程序使用 CAS 3.4.11、Spring 3.1 和 Hibernate 4。 我的 login-webflow.xml 使用 spring-webflow-2.0.xsd,登录流程如下,

<var name="credentials" class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials" />

   <on-start>
     <evaluate expression="initialFlowSetupAction" />
   </on-start>

   <view-state id="viewLoginForm" view="casLoginView" model="credentials">
     <binder>
       <binding property="username" />
       <binding property="password" />
     </binder>
     <on-entry>
       <set name="viewScope.commandName" value="'credentials'" />
     </on-entry>
     <transition on="submit" bind="true" validate="true" to="realSubmit">
        <evaluate expression="authenticationViaFormAction.doBind(flowRequestContext, flowScope.credentials)" />
     </transition>
   </view-state>

bean "initialFlowSetupAction" 和 "authenticationViaFormAction" 在 cas-servlet.xml 中定义为,

<bean id="initialFlowSetupAction" class="org.jasig.cas.web.flow.InitialFlowSetupAction"
        p:argumentExtractors-ref="argumentExtractors"
        p:warnCookieGenerator-ref="warnCookieGenerator"
        p:ticketGrantingTicketCookieGenerator-ref="ticketGrantingTicketCookieGenerator"/>

  <bean id="authenticationViaFormAction" class="org.jasig.cas.web.flow.AuthenticationViaFormAction"
        p:centralAuthenticationService-ref="centralAuthenticationService"
        p:warnCookieGenerator-ref="warnCookieGenerator"/>

这里的问题是,在启动登录页面时会调用 InitialFlowSetupAction。单击“登录”按钮时,应调用 AuthenticationViaFormAction 类的绑定/提交方法。但始终调用 InitialFlowSetupAction 并重新显示表单,没有任何异常。至少我可以跟踪是否有异常。

将其属性设置为 UsernamePasswordCredentials 是否会是表单的用户名和密码字段的绑定问题?

基本上我想知道为什么 InitialFlowSetupAction 在单击“登录”按钮时被调用?

【问题讨论】:

    标签: java


    【解决方案1】:

    可能是因为您的表单不包含“_flowExecutionKey”字段的值。 它应该包含下一个输入元素,以便能够恢复流执行。

    <form>
        ...
        <input type="hidden" name="_eventId" value="submit" />
        <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
    </form>
    

    http://static.springsource.org/spring-webflow/docs/2.0-m1/reference/flow-executor.html

    在 CAS 3.5.2 中,出于某种原因,使用字段“执行”而不是“_flowExecutionKey”。

    【讨论】:

      【解决方案2】:

      尝试将 validate 设置为 false:

      &lt;transition on="submit" bind="true" validate="false" to="realSubmit"&gt;

      【讨论】:

        猜你喜欢
        • 2013-07-17
        • 2019-09-13
        • 1970-01-01
        • 2023-04-09
        • 2016-11-17
        • 1970-01-01
        • 1970-01-01
        • 2012-12-16
        • 1970-01-01
        相关资源
        最近更新 更多