两个问题:春季安全与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。 –