1

我正在使用Spring Webflow和Spring Security的應用程序。我對這兩方面都很陌生,處於學習階段。我的問題是關於如何解密特定的彈簧流。我有以下主flow.xml其內容是 -使用Spring Security解除Spring流程

<flow xmlns ... > 
<subflow-state id="demoSubflowId" subflow="demo/subflow"> 
    <transition to="search" /> 
</subflow-state> 

... //There are other subflows configured here 

的subflow.xml存在一個名爲「演示」另一個目錄中。

在Spring 安全-config.xml中,我有這個配置我假設作保全webflows - 需要對應用程序中所有的流

<http access-decision-manager-ref="customAccessDecisionManager"> 
    <intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" /> 
    <form-login always-use-default-target="true" default-target-url="/spring/main" login-page="/secureLogin" 
     authentication-failure-url="/secureLogin" /> 
    <logout success-handler-ref="logoutSuccessHandler" /> 
    <custom-filter position="LAST" ref="requestInspectionFilter" /> 
</http> 

目前認證。但是現在我得到了一項任務,爲不需要驗證的任務創建新的子流。這就是爲什麼我使用id = demoSubflowId創建了新的子流程的原因,但是每次我嘗試從下面的xhtml代碼中打開這個流程時,它都會將我重定向到登錄頁面。

<a href="#" onclick="document.myForm.submit();" class="btn">Xhtml Unsecured demo</a> 

<form name="myForm" action="${pageContext.request.contextPath}/spring/main?moduleId=mySubflowId" method="post"> </form> 

任何人都可以幫我解決一個特定的Spring Web流/子流嗎?我搜索了一下,發現如何從spring-security中排除URL。在我當前的應用程序中,我們也有servlet URL,這些URL不安全(如下所述)並在security-config.xml中配置,但我不知道如何爲Spring Webflow URL執行此操作。

<http pattern="/secureLogin*" security="none" /> 
<http pattern="/resetPassword" security="none" /> 

任何幫助/建議unsecuring春季webflow將不勝感激。提前致謝。

回答

0

假設你訪問使用/main這似乎是在您的配置的情況下你的流程,你應該能夠「不安全它」用這樣的:

<http pattern="/main" security="none" /> 

[編輯]

它並不完美,但在你的主流程,您可以使用手動<secured>確保其他子流:

<secured attributes="ROLE_USER" /> 
+0

我通過附加的moduleId的主URL像訪問/春/主?的moduleId = mySubflowId。該URL在上面的第二個代碼片段中提供。如果我按照自己的方式進行操作,那麼有可能所有子流都不安全。我只想解除一個特定的子流程,例如。如問題中提到的mySubflowId。 – Manish

+0

編輯我的答案 – rptmat57