Shiro 權限標籤

Shiro 權限標籤:

  導入標籤庫:

<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

  權限標籤:

guest標籤
  <shiro:guest>
  </shiro:guest>
  用戶沒有身份驗證時顯示相應信息,即遊客訪問信息。

user標籤
  <shiro:user>  
  </shiro:user>
  用戶已經身份驗證/記住我登錄後顯示相應的信息。

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

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

principal標籤
  <shiro: principal/>
  
  <shiro:principal property="username"/>
  相當於((User)Subject.getPrincipals()).getUsername()。

lacksPermission標籤
  <shiro:lacksPermission name="org:create">
 
  </shiro:lacksPermission>
  如果當前Subject沒有權限將顯示body體內容。

hasRole標籤
  <shiro:hasRole name="admin">  
  </shiro:hasRole>
  如果當前Subject有角色將顯示body體內容。

hasAnyRoles標籤
  <shiro:hasAnyRoles name="admin,user">
   
  </shiro:hasAnyRoles>
  如果當前Subject有任意一個角色(或的關係)將顯示body體內容。

lacksRole標籤
  <shiro:lacksRole name="abc">  
  </shiro:lacksRole>
  如果當前Subject沒有角色將顯示body體內容。

hasPermission標籤
  <shiro:hasPermission name="user:create">  
  </shiro:hasPermission>
  如果當前Subject有權限將顯示body體內容
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章