我是Spring Security的新手。我使用JSF2使用Spring Security 3.三個問題:jsf spring security用戶信息
如何訪問,從會話管理的bean,用戶信息(姓名,密碼,角色)當前登錄的用戶?
爲了在視圖中使用它,例如根據用戶的角色呈現元素。
如何知道用戶是否已登錄?爲了在視圖中顯示用戶未登錄的「登錄鏈接」或用戶登錄的「登出鏈接」,必須使用Spring Security的哪個屬性來存儲此信息並在視圖中使用它?
「登錄鏈接」只是對登錄頁面的URL的GET請求。但是我怎樣才能顯示「註銷鏈接」?難道它必須是一個POST請求,並使用「H:commandLink」像這樣?:
<h:commandLink value="Logout" action="#{request.contextPath}/j_spring_security_logout" />
或者,它可以是一個GET請求?:
<h:link value="Logout" outcome="#{request.contextPath}/j_spring_security_logout" />
感謝您非常高級。
也許這可以提供一些幫助 - http://static.springsource.org/spring-security/site/docs/3.0.x/reference/el-access.html –