Shiro标签库
来源:互联网 发布:java getclasspath 编辑:程序博客网 时间:2024/05/21 17:45
Shiro提供了一套JSP标签库来实现页面级的授权控制。
在使用Shiro标签库前,首先需要在JSP引入shiro标签:
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
下面一一介绍Shiro的标签:
guest标签
验证当前用户是否为“访客”,即未认证(包含未记住)的用户。
<shiro:guest>
Hi there! Please <a href="login.jsp">Login</a> or <a href="signup.jsp">Signup</a> today!
</shiro:guest>
user标签
认证通过或已记住的用户。
<shiro:user>
Welcome back John! Not John? Click <a href="login.jsp">here<a> to login.
</shiro:user>
authenticated标签
已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。
<shiro:authenticated>
<a href="updateAccount.jsp">Update your contact information</a>.
</shiro:authenticated>
notAuthenticated标签
未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。
<shiro:notAuthenticated>
Please <a href="login.jsp">login</a> in order to update your credit card information.
</shiro:notAuthenticated>
principal 标签
输出当前用户信息,通常为登录帐号信息。
Hello, <shiro:principal/>, how are you today?
hasRole标签
验证当前用户是否属于该角色。
<shiro:hasRole name="administrator">
<a href="admin.jsp">Administer the system</a>
</shiro:hasRole>
lacksRole标签
与hasRole标签逻辑相反,当用户不属于该角色时验证通过。
<shiro:lacksRole name="administrator">
Sorry, you are not allowed to administer the system.
</shiro:lacksRole>
hasAnyRole标签
验证当前用户是否属于以下任意一个角色。
<shiro:hasAnyRoles name="developer, project manager, administrator">
You are either a developer, project manager, or administrator.
</shiro:lacksRole>
hasPermission标签
验证当前用户是否拥有指定权限。
<shiro:hasPermission name="user:create">
<a href="createUser.jsp">Create a new User</a>
</shiro:hasPermission>
lacksPermission标签
与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。
<shiro:hasPermission name="user:create">
<a href="createUser.jsp">Create a new User</a>
</shiro:hasPermission>
- apache shiro 标签库
- Shiro标签库
- shiro 之 Shiro 标签
- Shiro标签
- Shiro标签
- Apache Shiro JSP/GSP标签库
- Apache Shiro Web应用整合-标签库
- Apache Shiro Web应用整合-标签库
- Shiro jsp页面标签
- shiro权限验证标签
- shiro权限验证标签
- shiro权限验证标签
- freemarker集成shiro标签
- Shiro权限验证标签
- shiro权限验证标签
- shiro权限验证标签
- shiro jsp标签使用
- shiro权限验证标签
- pytorch学习笔记(七):pytorch hook 和 关于pytorch backward过程的理解
- elcipse护眼色背景和字体颜色设置
- android.support.v4.app.Fragment和android.app.Fragment区别
- nyoj ACM:zb的生日(DFS 递归 回溯)
- pandas Series DataFrame 丢弃指定轴上的项(三)
- Shiro标签库
- windows下mongodb安装与使用整理
- Android stuido JCenter 下载慢问题解决
- zeppelin源码分析(3)——主要的class分析(上)
- <0_0 实现>Java 将字符串首字母转为大写
- 10763--Foreign Exchange--Uva
- PHP无限级分类实现(递归+非递归)
- C#数组的声明
- 使用Xbrowser远程连接REHL6.5