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> ...
随机推荐
- 将页面上的内容导出到Excel
<asp:Button ID="lkbExport" runat="server" Name="Save" Text="导出 ...
- CDH5X 安装oozie报错To enable Oozie web console install the Ext JS library.
最近在CDH5.X 安装oozie 服务,服务安装完毕,访问oozie server ui,报如下错误: 页面提示: Oozie web console is disabled.To enable O ...
- UWP/Win10新特性系列—Drag&Drop 拖动打开文件
在Win10 App开发中,微软新增了系统PC文件与UWP 之间的文件拖拽行为,它支持将系统磁盘上的文件以拖拽的形式拖入App中并处理,在前不久的微软build 2015开发者大会上微软展示的UWP版 ...
- wordpress模板学习之导航目录
wordpress的导航目录分为三个部分,一开启,二配置:三使用 开启在functions.php,这个注册会保存在全局变量中,接下来在菜单配置中会看到 register_nav_menu( 'pri ...
- 前端一:走进HTML
一:HTML(HyperText Markup Language)介绍 超文本标记语言,标准通用标记语言下的一个应用.“超文本”就是指页面内可以包含图片.链接,甚至音乐.程序等非文字元素.超文本标记语 ...
- 手动搭建Vue环境
Vue+webpack+babel环境搭建 github地址 https://github.com/haoyongliang/webpack-babel-Vue 1.首先要了解Vue项目结构 简单的目 ...
- web前后端框架整理
nodejs <——> Express <———> bootstrap <———> angularJS <————> jquery <—————& ...
- Sublime Text2 快捷键汇总
一个好的编辑器,能大大提高编程的效率.如果能熟知软件的快捷键,那更能让你得心印手.这些内容都是我网上和自己实际使用过程中所收集而来的,在网络上应该也算比较全面的了吧.欢迎大家补充,我也会在以后慢慢添加 ...
- lua userdata
#define metatablename "studentlib.06-11-11" /** * utility functions */ static int pusherro ...
- node.js Websocket消息推送---GoEasy
Goeasy, 它是一款第三方推送服务平台,使用它的API可以轻松搞定实时推送!个人感觉goeasy推送更稳定,推送 速度快,代码简单易懂上手快 浏览器兼容性:GoEasy推送 支持websocket ...