-----------------標簽-------------------------------
<shiro:guest> 游客訪問 <a href = "login.jsp"></a> </shiro:guest> user 標簽:用戶已經通過認證\記住我 登錄后顯示響應的內容 <shiro:user> 歡迎[<shiro:principal/>]登錄 <a href = "logout">退出</a> </shiro:user> authenticated標簽:用戶身份驗證通過,即 Subjec.login 登錄成功 不是記住我登錄的 <shiro:authenticted> 用戶[<shiro:principal/>] 已身份驗證通過 </shiro:authenticted> notAuthenticated標簽:用戶未進行身份驗證,即沒有調用Subject.login進行登錄,包括"記住我"也屬於未進行身份驗證 <shiro:notAuthenticated> 未身份驗證(包括"記住我") </shiro:notAuthenticated> principal 標簽:顯示用戶身份信息,默認調用 Subjec.getPrincipal()獲取,即Primary Principal <shiro:principal property = "username"/> hasRole標簽:如果當前Subject有角色將顯示body體內的內容 <shiro:hashRole name = "admin"> 用戶[<shiro:principal/>]擁有角色admin </shiro:hashRole> hasAnyRoles標簽:如果Subject有任意一個角色(或的關系)將顯示body體里的內容 <shiro:hasAnyRoles name = "admin,user"> 用戶[<shiro:pricipal/>]擁有角色admin 或者 user </shiro:hasAnyRoles> lacksRole:如果當前 Subjec沒有角色將顯示body體內的內容 <shiro:lacksRole name = "admin"> 用戶[<shiro:pricipal/>]沒有角色admin </shiro:lacksRole> hashPermission:如果當前Subject有權限將顯示body體內容 <shiro:hashPermission name = "user:create"> 用戶[<shiro:pricipal/>] 擁有權限user:create </shiro:hashPermission> lacksPermission:如果當前Subject沒有權限將顯示body體內容 <shiro:lacksPermission name = "org:create"> 用戶[<shiro:pricipal/>] 沒有權限org:create </shiro:lacksPermission>
---------------權限注解------------------------
@RequiresAuthenthentication:表示當前Subject已經通過login進行身份驗證;即 Subjec.isAuthenticated()返回 true @RequiresUser:表示當前Subject已經身份驗證或者通過記住我登錄的, @RequiresGuest:表示當前Subject沒有身份驗證或者通過記住我登錄過,即是游客身份 @RequiresRoles(value = {"admin","user"},logical = Logical.AND):表示當前Subject需要角色admin和user @RequiresPermissions(value = {"user:delete","user:b"},logical = Logical.OR):表示當前Subject需要權限user:delete或者user:b