shiro標籤

1).authenticated 標籤:用戶已經身份驗證通過,即Subject.login登錄成功,不是記住我登錄的。
<shiro:authenticated>
    用戶[<shiro:principal/>]已身份驗證通過
</shiro:authenticated>

2).notAuthenticated 標籤:用戶未進行身份驗證,即沒有調用Subject.login進行登錄,包括記住我自動登錄的也屬於未進行身份驗證。
<shiro:notAuthenticated>
    身份未驗證(包括記住我)
</shiro:notAuthenticated>

3).pincipal 標籤:顯示用戶身份信息,默認調用Subject.getPrincipal()獲取,即Primary principal
<shiro:principal property="username"/>

4).hasRole 標籤:如果當前Subject有角色將顯示body體內容:
<shiro:hasRole name="admin">
    用戶:[<shiro:principal>]擁有角色<br/>
</shiro:hasRole>

5).lacksRole:如果當前Subject沒有角色將顯示Body體內容
<shiro:lacksRole name="admin">
    用戶[<shiro:principal/>]擁有權限user.create<br/>
</shiro:lacksRole>

6).hasPermission:如果當前Subject有權限將顯示body體內容
<shiro:hasPermission name="info:link:edit">
!!!
</shiro:hasPermission>
發佈了75 篇原創文章 · 獲贊 8 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章