兩個問題:春季安全與JSF
問題1:
我有我的applicaitonContext-security.xml
文件中的以下內容:
<security:http auto-config="true" access-denied-page="/denied.jsf" servlet-api-provision="false">
<security:intercept-url pattern="/denied.jsf" filters="none" />
<security:intercept-url pattern="/login.jsf" filters="none" />
<security:intercept-url pattern="/redirect.html" filters="none" />
<security:intercept-url pattern="/images/**" filters="none" />
<security:intercept-url pattern="/a4j_resource/**" filters="none" />
<security:intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />
<security:form-login login-page="/login.jsf" authentication-failure-url="/login.jsf" default-target-url="/redirect.html" />
<security:logout />
</security:http>
,但是當我去http://localhost:8080/summary/projects.jsf
我不t重定向到login.jsf
頁面。有任何想法嗎。
問題2: 在projects.xhtml
的網頁我有
<rich:comboBox value="#{projectUiService.coordinatorSelected}" directInputSuggestions="true" defaultLabel="Enter Co-ordinator" >
在getCoordinatorSelected
方法我有@RolesAllowed("READ_PROJECT")
,但我得到的是錯誤:
AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext
我如何讓Spring在用戶未登錄時重定向到登錄頁面,如果用戶沒有正確的權限,如何將其重定向到denied.jsf
頁面?
我已經四處尋找了最後6小時,並試圖加載日誌,但找不到解決方案。任何指針將不勝感激。
感謝
' '不能作爲父''標記的子元素。 –
是的。您需要多個頂級標記。 –
解決了!請參閱下面的答案以獲得完整的解釋。謝謝Maksym。 –