`
lijingzhi
  • 浏览: 41896 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
社区版块
存档分类
最新评论

20130117-使用Grails Shiro Plugin实现身份验证03

 
阅读更多

上一篇完成了一个完整的用户注册登录过程,本节主要记录shiro的一些标签的作用

Shiro标签

1、如果用户已经登录了,可以用这个标签用来输出你的信息,如登录用户的用户名

<shiro:isLoggedIn>Body</shiro:isLoggedIn>
<shiro:authenticated/>

2、如果用户没有登录,可以用这个标签输出信息,如注册链接

<shiro:isNotLoggedIn>Body</shiro:isNotLoggedIn>
<shiro:notAuthenticated/>

3、如果在remember me或者用户已经登录,可以用这个标签获取到用户信息

<shiro:user>Body</shiro:user>

4、可以用这个标签检测用户是否已经登录,或者在remember me中是否有记录

<shiro:notUser>Body</shiro:notUser>

5、这个标记用来记录remember me信息到session

<shiro:remembered>Body</shiro:remembered>

6、这个标签用来删除remember me到session中的信息

<shiro:notRemembered>Body</shiro:notRemembered>

7、这个标签用来记录用户信息,如果用户已经登录则显示用户,如果没有登录,则显示匿名

<shiro:principal type="type" property="property" />

8、这个标签用来获取登录用户的角色

<shiro:hasRole name="role_name">Body</shiro:hasRole>

9、这个标签用来获取当前用户没有的角色

<shiro:lacksRole name="role_name">Body</shiro:lacksRole>

10、这个标签用来输出当前用户已有的角色

<shiro:hasAllRoles in="roles">Body</shiro:hasAllRoles>

11、这个标签用来暑促当前用户没有的角色

<shiro:lacksAllRoles in="roles">Body</shiro:lacksAllRoles>

12、这个标签用来输出用户拥有的特定角色

<shiro:hasAnyRole in="roles">Body</shiro:hasAnyRole>

13、这个标签用来输出用户没有的特定角色

<shiro:lacksAnyRole in="roles">Body</shiro:lacksAnyRole>

14、这个标签用来输出用户所拥有的角色

<shiro:hasPermission type="type"
                     permission="permission"
                     actions="actions"
                     target="target">Body</shiro:hasPermission>

参考资料

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics