Shiro标签
在使用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标签的更多相关文章
- shiro 标签
		在使用Shiro标签库前,首先需要在JSP引入shiro标签: <%@ taglib prefix="shiro" uri="http://shiro.apache ... 
- freemarker 集成 sitemesh 装饰html页面    shiro 标签
		guest标签:验证当前用户是否为"访客",即未认证(包含未记住)的用户: shiro标签:<shiro:guest></shiro:guest> : ... 
- Apache Shiro 标签方式授权
		Shiro提供了一套JSP标签库来实现页面级的授权控制. 在使用Shiro标签库前,首先需要在JSP引入shiro标签: <%@ taglib prefix="shiro" ... 
- Shiro笔记(六)Shiro标签的使用
		Shiro标签的使用 引入标签库 <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"% ... 
- Freemarker 的 Shiro 标签使用详解
		一.引入依赖(已解决版本冲突) <!-- shiro-freemarker-tags start --> <dependency> <groupId>net.min ... 
- 请教Nutzwk项目,在beetl页面怎么用shiro标签呢?
		请教Nutzwk项目,在beetl页面怎么用shiro标签呢? 发布于 381天前 作者 WenTao-Love 195 次浏览 复制 上一个帖子 下一个帖子 标签: nutzwk 如题 ... 
- freemarker使用shiro标签(spring boot)
		freemarker使用shiro标签(spring boot) 2018年07月03日 14:20:37 niu_sayok 阅读数:348更多 个人分类: freeMarkerShiro 首先 ... 
- springboot下html的js中使用shiro标签功能
		在js中直接使用shiro标签是不行的 比如 下面有个小技巧 
- springboot与shiro在html中使用shiro标签
		上一章讲环境搭建 springboot与shiro和mybatis和mysql 现在讲html中怎么使用shiro标签,这里是基于上一章讲的 在pom文件引入依赖 <dependency> ... 
随机推荐
- 感知机的对偶形式——python3实现
			运用对偶的(对应原始)感知机算法实现线性分类. 参考书目:<统计学习方法>(李航) 算法原理: 代码实现: 环境:win7 32bit + Anaconda3 +spyder 和原始算法的 ... 
- python 字符串内建函数
			方法 描述 string.capitalize() 把字符串的第一个字符大写 string.center(width) 返回一个原字符串居中,并使用空格填充至长度 width 的新字符串 string ... 
- G - 小希的迷宫
			Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Pract ... 
- cs231n笔记:最优化
			本节是cs231学习笔记:最优化,并介绍了梯度下降方法,然后应用到逻辑回归中 引言 在上一节线性分类器中提到,分类方法主要有两部分组成:1.基于参数的评分函数.能够将样本映射到类别的分值.2.损失函数 ... 
- HttpClient方式模拟http请求
			方式一:HttpClient import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.http.*; im ... 
- HttpClient方式模拟http请求设置头
			关于HttpClient方式模拟http请求,请求头以及其他参数的设置. 本文就暂时不给栗子了,当作简版参考手册吧. 发送请求是设置请求头:header HttpClient httpClient = ... 
- Decorator实现AOP编程。
			Program.cs class Program { static void Main(string[] args) { User user = " }; var processor = T ... 
- "错误消息 401.2。: 未经授权: 服务器配置导致登录失败。"的解决办法
			[详细报错如下]: “/”应用程序中的服务器错误. 访问被拒绝. 说明: 访问服务此请求所需的资源时出错.服务器可能未配置为访问所请求的 URL. 错误消息 401.2.: 未经授权: 服务器配置导致 ... 
- git下载教程
			1.git for windows的下载链接 1.*的版本 https://github.com/msysgit/msysgit/releases 2.*的版本 https://github. ... 
- 观 GT Java语言管理系统的感悟
			继上次java系统考核完... 坦白说,我对我自己写的例子还是很满意的,虽说学长们给的评价不高 ,但我一直以为是学长们对我们的要求太高,以他们的眼光在看待我们,所以我对学长们给的评价并没有太过在意,当 ... 
