我對項目使用Spring Security 3.0.3。Spring Security Interceptor-URL不起作用
該項目有3個方面應該對不同的人
因此可以訪問我創建了以下結構 - WEB-INF /(供大家=無保護) - WEB-INF /應用程序(用戶= ROLE_USER ) - WEB-INF/app/admin.jsf(適用於管理員= ROLE_ADMIN)
admin.jsf位於同一目錄中,我無法改變不幸。
我的用戶信息從數據庫中加載。
它們定義如下:
<bean id="preAuthenticatedProcessingFilterEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/> <security:http entry-point-ref="preAuthenticatedProcessingFilterEntryPoint" >
<security:custom-filter position="PRE_AUTH_FILTER" ref="MyFilter"/>
<security:intercept-url pattern="/app/admin.jsf" access="ROLE_ADMIN" />
<security:intercept-url pattern="/app/**" access="ROLE_USER" />
<security:intercept-url pattern="/**" access="" />
</security:http>
現在,一切都很正常。用戶數據被加載,角色是根據DB但設置不幸
- 未受保護的區域是accessable所有(這就是OK)
- 管理員可以看到每一個頁面(因爲它們是ROLE_USER太)
- 角色的用戶無法在應用中輸入頁面
有沒有人有暗示我做錯了什麼? 我本地測試,並在瀏覽器網址是:http://localhost:8080/my_app/app/admin.jsf
到目前爲止,我能確定的Spring Security忽略我的角色問題的根源。攔截網址的模式正在起作用,不幸的是,我定義的角色並不這樣做。
我終於能夠找出問題所在:一個同事在第二個配置文件檢查,我modiefied錯了。 grml
ROLE_USER的用戶試圖訪問頁面/app/abc.html時出現什麼錯誤? – thait84
是否通過以下方式請求管理員視圖:http://://app/admin.jsf? –
Ralph
@ thait84:http error 403 – monty