thymeleaf-extras-shiro
thymeleaf-extras-shiro
转载:https://github.com/theborakompanioni/thymeleaf-extras-shiro
A Thymeleaf dialect for Apache Shiro tags.
Download
Maven
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>${thymeleaf-shiro.version}</version>
</dependency>
Jar
Download from Maven Central.
Repository
git clone https://github.com/theborakompanioni/thymeleaf-extras-shiro.git
Example
<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <head>
<title>thymeleaf-extras-shiro</title>
</head> <body>
<p shiro:guest="">Please <a href="login.html">login</a></p>
<p shiro:authenticated="">
Hello, <span shiro:principal=""></span>, how are you today?
</p>
</body> </html>
Tags
The following examples show how to integrate the tags in your Thymeleaf templates. These are all implementations of the examples given in the JSP / GSP Tag Library Section of the Apache Shiro documentation.
Tags can be written in attribute or element notation:
Attribute
<p shiro:anyTag>
Goodbye cruel World!
</p>
Element
<shiro:anyTag>
<p>Hello World!</p>
</shiro:anyTag>
The guest tag
<p shiro:guest="">
Please <a href="login.html">Login</a>
</p>
The user tag
<p shiro:user="">
Welcome back John! Not John? Click <a href="login.html">here<a> to login.
</p>
The authenticated tag
<a shiro:authenticated="" href="updateAccount.html">Update your contact information</a>
The notAuthenticated tag
<p shiro:notAuthenticated="">
Please <a href="login.html">login</a> in order to update your credit card information.
</p>
The principal tag
<p>Hello, <span shiro:principal=""></span>, how are you today?</p>
or
<p>Hello, <shiro:principal/>, how are you today?</p>
Typed principal and principal property are also supported.
The hasRole tag
<a shiro:hasRole="administrator" href="admin.html">Administer the system</a>
The lacksRole tag
<p shiro:lacksRole="administrator">
Sorry, you are not allowed to administer the system.
</p>
The hasAllRoles tag
<p shiro:hasAllRoles="developer, project manager">
You are a developer and a project manager.
</p>
The hasAnyRoles tag
<p shiro:hasAnyRoles="developer, project manager, administrator">
You are a developer, project manager, or administrator.
</p>
The hasPermission tag
<a shiro:hasPermission="user:create" href="createUser.html">Create a new User</a>
The lacksPermission tag
<p shiro:lacksPermission="user:delete">
Sorry, you are not allowed to delete user accounts.
</p>
The hasAllPermissions tag
<p shiro:hasAllPermissions="user:create, user:delete">
You can create and delete users.
</p>
The hasAnyPermissions tag
<p shiro:hasAnyPermissions="user:create, user:delete">
You can create or delete users.
</p>
thymeleaf-extras-shiro的更多相关文章
- Thymeleaf集成Shiro,shiro权限使用el表达式
如果是Thymeleaf集成Shiro的话, 如果使用Shiro在页面上权限字符串需使用thymeleaf的表达式的话, 如果权限字符串在实例级别的话, 可以使用这种方式进行权限字符串的动态实例控制 ...
- springboot thymeleaf和shiro标签整合
这里用的是 thymeleaf 2.x版本的 添加依赖 <dependency> <groupId>com.github.theborakompanioni</group ...
- thymeleaf 与shiro 整合错误
错误 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { // ...
- springboot 2.x处理404、500等异常
404错误 404错误是不经过Controller的,所以使用@ControllerAdvice或@RestControllerAdvice无法获取到404错误 springboot2处理404错误的 ...
- Java-Maven-pom.xml-project-dependencies:dependencies
ylbtech-Java-Maven-pom.xml-project-dependencies:dependencies 1.java 调用ddl <!-- java 调用ddl --> ...
- shiro学习(五、springboot+shiro+mybatis+thymeleaf)
入门shiro(感觉成功了)首先感谢狂神,然后我就一本正经的复制代码了 项目结构 运行效果 数据库 <dependencies> <!-- thymeleaf-shiro整合包 -- ...
- thymeleaf模板引擎shiro集成框架
shiro权限框架.前端验证jsp设计.间tag它只能用于jsp系列模板引擎. 使用最近项目thymeleaf作为前端模板引擎,采用HTML档,未出台shiro的tag lib,假设你想利用这段时间s ...
- Spring Boot 整合 Shiro+Thymeleaf
1.导包 <!-- springboot 与 shiro 的集成--> <dependency> <groupId>org.apache.shiro</gro ...
- (八) SpringBoot起飞之路-整合Shiro详细教程(MyBatis、Thymeleaf)
兴趣的朋友可以去了解一下前几篇,你的赞就是对我最大的支持,感谢大家! (一) SpringBoot起飞之路-HelloWorld (二) SpringBoot起飞之路-入门原理分析 (三) Sprin ...
- Springboot2.0 集成shiro权限管理
在springboot中结合shiro教程搭建权限管理,其中几个小细节的地方对新手不友好,伸手党更是无法直接运行代码,搭建过程容易遇坑,记录一下.关键的地方也给注释了. 版本:springboot版本 ...
随机推荐
- KindEditor:Ajax提交表单时获取不到HTML内容
当用Ajax提交表单时,KindEditor的内容获取不到,HTML数据获取不了 原因:当ajax提交时,KindEdito的HTML数据还没有同步到表单中来,那怎么去获取HTML数据呢? ----- ...
- [百家号]华为:最强ARM服务器芯片,华为鲲鹏920处理器发布
华为:最强ARM服务器芯片,华为鲲鹏920处理器发布 泡泡网 百家号2019-01-0716:11 https://baijiahao.baidu.com/s?id=162198839753232 ...
- 用send_keys输入文本的方法
我们使用app时,输入文字都是调用软键盘.在自动化测试中当然也可以调用软键盘,但是由于输入法设计上的差异,有时候不能达到很好的效果. 例如,搜狗拼音输入法: 选择4-咖啡,然而多打几次,输入法就把“咖 ...
- Luogu4783 【模板】矩阵求逆(高斯消元)
对矩阵进行高斯消元直至消为单位矩阵,并在另一个单位矩阵上对其做同样的操作即可. 模意义下的高斯消元可以直接计算系数来避免整行的辗转相除. 还不知道有什么用. #include<iostream& ...
- 【刷题】LOJ 6015 「网络流 24 题」星际转移
题目描述 由于人类对自然资源的消耗,人们意识到大约在 2300 年之后,地球就不能再居住了.于是在月球上建立了新的绿地,以便在需要时移民.令人意想不到的是,2177 年冬由于未知的原因,地球环境发生了 ...
- 洛谷P4338 [ZJOI2018]历史(LCT,树形DP,树链剖分)
洛谷题目传送门 ZJOI的考场上最弱外省选手T2 10分成功滚粗...... 首先要想到30分的结论 说实话Day1前几天刚刚刚掉了SDOI2017的树点涂色,考场上也想到了这一点 想到了又有什么用? ...
- cf1066F Yet Another 2D Walking (贪心+dijkstra)
易证我们走的时候只会从某一层的某端点走向另一端点.然后走向下一层的某端点.. 所以建图然后dijkstra就行了 调了一年以后发现dijkstra写错了 #include<bits/stdc++ ...
- DynamicSegmentTree
最近尝试了一下动态开点线段树,英文直译就是Dynamic Open Point Segment Tree,太SB了. 就跟之前的主席树写法差不多. if(!x || x == y) { x = ++t ...
- C++并发编程之std::async(), std::future, std::promise, std::packaged_task
c++11中增加了线程,使得我们可以非常方便的创建线程,它的基本用法是这样的: void f(int n); std::thread t(f, n + 1); t.join(); 但是线程毕竟是属于比 ...
- 配置httpd2.4与常见的I/O模型说明
配置httpd2.4与常见的I/O模型说明 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.httpd2.4访问控制 1.基于IP访问控制: 允许所有主机访问:Require a ...