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的更多相关文章

  1. Thymeleaf集成Shiro,shiro权限使用el表达式

    如果是Thymeleaf集成Shiro的话, 如果使用Shiro在页面上权限字符串需使用thymeleaf的表达式的话, 如果权限字符串在实例级别的话, 可以使用这种方式进行权限字符串的动态实例控制 ...

  2. springboot thymeleaf和shiro标签整合

    这里用的是 thymeleaf 2.x版本的 添加依赖 <dependency> <groupId>com.github.theborakompanioni</group ...

  3. thymeleaf 与shiro 整合错误

    错误 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { // ...

  4. springboot 2.x处理404、500等异常

    404错误 404错误是不经过Controller的,所以使用@ControllerAdvice或@RestControllerAdvice无法获取到404错误 springboot2处理404错误的 ...

  5. Java-Maven-pom.xml-project-dependencies:dependencies

    ylbtech-Java-Maven-pom.xml-project-dependencies:dependencies 1.java 调用ddl <!-- java 调用ddl --> ...

  6. shiro学习(五、springboot+shiro+mybatis+thymeleaf)

    入门shiro(感觉成功了)首先感谢狂神,然后我就一本正经的复制代码了 项目结构 运行效果 数据库 <dependencies> <!-- thymeleaf-shiro整合包 -- ...

  7. thymeleaf模板引擎shiro集成框架

    shiro权限框架.前端验证jsp设计.间tag它只能用于jsp系列模板引擎. 使用最近项目thymeleaf作为前端模板引擎,采用HTML档,未出台shiro的tag lib,假设你想利用这段时间s ...

  8. Spring Boot 整合 Shiro+Thymeleaf

    1.导包 <!-- springboot 与 shiro 的集成--> <dependency> <groupId>org.apache.shiro</gro ...

  9. (八) SpringBoot起飞之路-整合Shiro详细教程(MyBatis、Thymeleaf)

    兴趣的朋友可以去了解一下前几篇,你的赞就是对我最大的支持,感谢大家! (一) SpringBoot起飞之路-HelloWorld (二) SpringBoot起飞之路-入门原理分析 (三) Sprin ...

  10. Springboot2.0 集成shiro权限管理

    在springboot中结合shiro教程搭建权限管理,其中几个小细节的地方对新手不友好,伸手党更是无法直接运行代码,搭建过程容易遇坑,记录一下.关键的地方也给注释了. 版本:springboot版本 ...

随机推荐

  1. OneZero第四周——预完成功能点统计

    本周OneZero将完成“统计”功能. 功能点统计如下: 1.主页单击记录,进入修改界面,修改记录. 2.主页长按记录,出现删除按钮,删除记录. 3.全部记录按分类进行饼图显示. 4.全部记录按分类进 ...

  2. 基于接口回调详解JUC中Callable和FutureTask实现原理

    Callable接口和FutureTask实现类,是JUC(Java Util Concurrent)包中很重要的两个技术实现,它们使获取多线程运行结果成为可能.它们底层的实现,就是基于接口回调技术. ...

  3. PHP从入门到精通

    php基本语法 1.变量类型 a.标量类型 bool integer float string b.复合类型 array object c.特殊类型 resource null d.伪类型 mixd ...

  4. Java微信二次开发(二)

    第二天,做微信文本消息接口请求与发送 需要导入库:dom4j-1.6.1.jar,xstream-1.3.1.jar 第一步:新建包com.wtz.message.response,新建类BaseMe ...

  5. oracle12c ORA-28040: No matching authentication protocol

    出错原因:11G客户端连12C数据库服务端会报这个错 解决方案一:CSDN优质解决方案,大家都说可以,然而我这边操作了不行 转自13楼:http://bbs.csdn.net/topics/39066 ...

  6. jquery 绑定文本即时查询功能

    bindFilterFunc: function () {             if ("\v" == "v") { // IE only          ...

  7. SpringBoot入坑指南之六:使用过滤器或拦截器

    在Web应用中,常常存在拦截全部或部分请求进行统一处理的应用场景,如权限校验.参数校验.性能监控等. 在SpringMVC框架中,我们可以通过过滤器或拦截器实现相关功能,spring-boot-sta ...

  8. 【转】单片机系统中数字滤波的算法【C程序整理】

    随机误差是有随机干搅引起的,其特点是在相同条件下测量同一个量时,其大小和符号做无规则变化而无法预测,但多次测量结果符合统计规律.为克服随机干搅引入的误差,硬件上可采用滤波技术,软件上可以采用软件算法实 ...

  9. 【UOJ #351】新年的叶子(树的直径,期望)

    题目链接 这的确是一道好题,我们不妨依循思路一步步推导,看问题是如何被解决的. 做一些约定,设$m$为树的叶子节点个数,设$len$为该树的直径(经过的点数). 毫无疑问,直径可能有多条,我们需要把所 ...

  10. RabbitMQ 客户端开发向导

    准备工作:composer 引入 php-amqplib 说明:本文说明基于 Java(主要说明原理),实现使用 php RabbitMQ Java 客户端使用 com.rabbitmq.client ...