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版本 ...
随机推荐
- Ubuntu 14.04 installation & bugs on Alienware-13
列一下Alienware 13笔记本配置: Processor: Intel Core 5th Generation i5-5200U Processor (3M Cache, up to 2.70 ...
- vue中npm run dev运行项目不能自动打开浏览器! 以及 webstorm跑vue项目jshint一直提示错误问题的解决方法!
vue中npm run dev运行项目不能自动打开浏览器!以及 webstorm跑vue项目jshint一直提示错误问题的解决方法! 1.上个项目结束就很久没有使用vue了,最近打算用vue搭建自己的 ...
- java配置环境变量与常用技巧
一.java入门 --->java平台 •Java SE Java Platform,Standard Edition-Java平台标准版. •Java EE Java Platform,Ent ...
- MyBatis传入多个参数的问题(转)
一.单个参数: public List<XXBean> getXXBeanList(String xxCode); <select id="getXXXBeanList&q ...
- 洛谷 P1993 小K的农场 解题报告
P1993 小K的农场 题目描述 小K在MC里面建立很多很多的农场,总共n个,以至于他自己都忘记了每个农场中种植作物的具体数量了,他只记得一些含糊的信息(共m个),以下列三种形式描述: 农场a比农场b ...
- 【bzoj3132】 Sdoi2013—森林
http://www.lydsy.com/JudgeOnline/problem.php?id=3123 (题目链接) 题意 给出$n$个点的森林,每个点有一个非负点权,$m$个操作.连接两个点,查询 ...
- CentOs 自带 PHP 之坑
在虚拟机上安装了CentOs6.5在上面安装了lnmp开发集成包(php7.1),对于之前没有任何开发经验的我来说,正常且安详滴在集成环境上开发着优雅的小bug. 然而我今天在Composer拉取代码 ...
- LeetCode 9 合并两个有序列表
将两个有序链表合并为一个新的有序链表并返回.新链表是通过拼接给定的两个链表的所有节点组成的. 示例: 输入:1->2->4, 1->3->4 输出:1->1->2- ...
- jsp中的EL和JSTL的关系
对于JSTL和EL之间的关系,这个问题对于初学JSP的朋友来说,估计是个问题,下面来详细介绍一下JSTL和EL表达式他们之间的关系,以及JSTL和EL一些相关概念! EL相关概念 JSTL一般要配合E ...
- JAVA记录-IntelliJ Idea 2017 免费激活方法(转载)
1. 到网站 http://idea.lanyus.com/ 获取注册码. 2.填入下面的license server: http://intellij.mandroid.cn/ http://ide ...