在使用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. Laravel 5 使用中的问题记录(持续更新)

    1.更新了blade模板却没有更新缓存 通过使用ftp上传文件到服务器,更新了blade模板,却没有更新缓存,经查,原因是系统时间的影响,通过ftp上传的模板文件修改时间与缓存文件的时间不一致,导致模 ...

  2. Rotate Image [LeetCode]

    You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...

  3. C# 技巧(1) C# 转换时间戳

    经常发现很多地方使用一个时间戳表示时间.比如: 1370838759  表示 2013年6月10日 12:32:39. 我们就需要一个工具,方便地转换这种时间格式 什么是时间戳? 时间戳, 又叫Uni ...

  4. linux 安装 ftp

    1 安装 vsftpd 查看是否已经安装 vsftpd rpm -qa | grep vsftpd 如果没有 则安装  安装命令如下 yum -y install vsftpd 设置开机启动 chkc ...

  5. AD 10 原理图编译错误

    在编译原理图时,经常会出现以下错误和警告,这里简单的累出一些错误和警告的原因: 1.floating net labels,这个是应为网标防止错误,应该将网标放在I/O或这连线的端点,或者是网标表错了 ...

  6. 在中心交换机前加入多wan口路由,华为中心交换机的学习

    1.前期经过学习,好多笔记不记得了.要慢慢实践,实战中学习一遍, 2.真实情况看图 3.我们没有接路由器的时候,连接cosle口入中心交换机.telnet上去. 命令行:sys_view undo i ...

  7. ios开发之数据存储

    iOS应用数据存储的常用方式 XML属性列表(plist)归档 Preference(偏好设置) NSKeyedArchiver归档(NSCoding) SQLite3 Core Data 应用沙盒 ...

  8. Jquery EasyUI DataGrid .net实例

    前台界面:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...

  9. 【Selenium2+Python】常用操作

    Webdriver中比较常用的操作元素的方法: clear()    清除输入框的默认内容 send_keys("xxx")    在一个输入框里输入xx内容 ——如果输入中文,则 ...

  10. BackTrack5-r3安装前需要的准备及说明

    一. 配置创建一个虚拟机,本教程用的是VMware-workstation-full-10.0.0,BT5-r3-GNOME-64镜像. 这里是BT5-r3-GNOME-64位种子:http://pa ...