在使用Shiro标签库前,首先需要在JSP引入shiro标签:

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

1、介绍Shiro的标签guest标签 :验证当前用户是否为“访客”,即未认证(包含未记住)的用户。

<shiro:guest>

Hi there! Please <a href="login.jsp">Login</a> or <a href="signup.jsp">Signup</a> today!

</shiro:guest>
  

2、user标签 :认证通过或已记住的用户。

<shiro:user>

Welcome back John! Not John? Click <a href="login.jsp">here<a> to login.

</shiro:user>
  

3、authenticated标签 :已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。

<shiro:authenticated>

<a href="updateAccount.jsp">Update your contact information</a>.

</shiro:authenticated>
  

4、notAuthenticated标签 :未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。

<shiro:notAuthenticated>

Please <a href="login.jsp">login</a> in order to update your credit card information.

</shiro:notAuthenticated>
  

5、principal 标签 :输出当前用户信息,通常为登录帐号信息。

1
Hello, <shiro:principal/>, how are you today?
  

6、hasRole标签 :验证当前用户是否属于该角色。

<shiro:hasRole name="administrator">

<a href="admin.jsp">Administer the system</a>

</shiro:hasRole>
  

7、lacksRole标签 :与hasRole标签逻辑相反,当用户不属于该角色时验证通过。

<shiro:lacksRole name="administrator">

Sorry, you are not allowed to administer the system.

</shiro:lacksRole>
  

8、hasAnyRole标签 :验证当前用户是否属于以下任意一个角色。

<shiro:hasAnyRoles name="developer, project manager, administrator">

You are either a developer, project manager, or administrator.

</shiro:lacksRole>
  

9、hasPermission标签 :验证当前用户是否拥有指定权限。

<shiro:hasPermission name="user:create">

<a href="createUser.jsp">Create a new User</a>

</shiro:hasPermission>

10、lacksPermission标签 :与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。

<shiro:hasPermission name="user:create">

<a href="createUser.jsp">Create a new User</a>

</shiro:hasPermission>

shiro 标签的更多相关文章

  1. Shiro标签

    在使用Shiro标签库前,首先需要在JSP引入shiro标签: <%@ taglib prefix="shiro" uri="http://shiro.apache ...

  2. freemarker 集成 sitemesh 装饰html页面 shiro 标签

      guest标签:验证当前用户是否为"访客",即未认证(包含未记住)的用户: shiro标签:<shiro:guest></shiro:guest>  : ...

  3. Apache Shiro 标签方式授权

    Shiro提供了一套JSP标签库来实现页面级的授权控制. 在使用Shiro标签库前,首先需要在JSP引入shiro标签: <%@ taglib prefix="shiro"  ...

  4. Shiro笔记(六)Shiro标签的使用

    Shiro标签的使用 引入标签库 <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"% ...

  5. Freemarker 的 Shiro 标签使用详解

    一.引入依赖(已解决版本冲突) <!-- shiro-freemarker-tags start --> <dependency> <groupId>net.min ...

  6. 请教Nutzwk项目,在beetl页面怎么用shiro标签呢?

    请教Nutzwk项目,在beetl页面怎么用shiro标签呢?  发布于 381天前  作者 WenTao-Love  195 次浏览  复制  上一个帖子  下一个帖子  标签: nutzwk 如题 ...

  7. freemarker使用shiro标签(spring boot)

    freemarker使用shiro标签(spring boot) 2018年07月03日 14:20:37 niu_sayok 阅读数:348更多 个人分类: freeMarkerShiro   首先 ...

  8. springboot下html的js中使用shiro标签功能

    在js中直接使用shiro标签是不行的 比如 下面有个小技巧

  9. springboot与shiro在html中使用shiro标签

    上一章讲环境搭建 springboot与shiro和mybatis和mysql 现在讲html中怎么使用shiro标签,这里是基于上一章讲的 在pom文件引入依赖 <dependency> ...

随机推荐

  1. 读javascript高级程序设计08-引用类型之Global、Math、String

    一.Global 所有在全局作用域定义的属性和方法,都属于Global对象. 1.URI编码: encodeURI():主要用于对整个URI编码.它不会对本身属于URI的特殊字符进行编码. encod ...

  2. WinForm程序打包说明

    如果使用的是VS2013需要下载并安装 Microsoft Visual Studio 2013 Installer Projects 下载地址:https://visualstudiogallery ...

  3. tslib1.4与Qt4.8.6的交叉编译与移植

    最近开始正式接触QT开发,网上看了些移植教程都写的有点乱,博客园的emouse思·睿有一篇写的很好的文章,下面是文章的链接 http://www.cnblogs.com/emouse/archive/ ...

  4. AspNetPager分页

    1.页面部分 <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefi ...

  5. 使用WinINet和WinHTTP实现Http访问

    使用WinINet和WinHTTP实现Http访问 Http访问有两种方式,GET和POST,就编程来说GET方式相对简单点,它不用向服务器提交数据,在这个例程中我使用POST方式,提交数据value ...

  6. 如何使用 WinInet 时提供下载上载进度信息

    概要许多开发人员都使用 WinInet 函数来下载或上载文件在 Internet 上的想要提供一个进度条以指示多少文件传输已完成,但多少就越长.您可以使用以下机制来完成此.Collapse image ...

  7. oracle生成行方法

    数据库记录是行的集合 set of row, 那么如何如何生成集合呢? oracle中常用的是 递归查询(with ... union all ...) 以及 connect by(树形查询) htt ...

  8. git学习(这个我没有整理,是我不断在学习的过程中,自己总结的,对象是我,不过有问题的,我们可以相互交流)

    每次git提交,都会有一个parent指针,指向上一次的commit ,   如果合并,master就和hotfix河道一起,就直接删除hotfix就OK     此时,虽然操作一样,大底层实现不一样 ...

  9. 4、android BroadcastReceiver详细用法

    BroadcastReceiver也就是“广播接收者”的意思,顾名思义,它就是用来接收来自系统和应用中的广播. 在Android系统中,广播体现在方方面面,例如当开机完成后系统会产生一条广播,接收到这 ...

  10. Enable SSHD on Ubuntu

    https://help.ubuntu.com/community/SSH/OpenSSH/Configuring