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版本 ...
随机推荐
- iOS国际化——通过脚本使storyboard翻译自增
一. 针对两种文件的国际化处理 代码中即.m文件的国际化 首先在你需要进行国际化处理的字符串外面加一层NSLocalizedString,注意中文也是可以的哦 textfield.text = [NS ...
- Xdebug原理
前言: 前面一篇博文记录了Xdebug的安装配置.配置使用起来相对简单易懂,那么Xdebug的实现原理又是如何呢?所以就找了些资料来理解下其中的原理. 内容: Xdebug工作原理 1,IDE(如Ph ...
- js 中引用类型 的深拷贝 和 浅拷贝的区别
一.曾经在读JQ源码的时候,对深拷贝算是有了一点的理解.我们在项目中是不是经常会遇到这样的问题呢? 后台返回一个数组对象(引用类型).次数在页面渲染中需要对部分数据进行处理 比如:银行卡6234509 ...
- Mac OS X使用简介
一.OS X 版本以大型猫科动物命名 10.0 猎豹(Cheetah) 10.1 美洲狮(Puma) 10.2 美洲虎(Jaguar) 10.3 黑豹(Panther) 10.4 ...
- 动态sql防止报错的写法 当判断语句都是null时候会报错 需要手动添加一个判断语句 一般id都会存在
- 【设计模式】—— 享元模式Flyweight
前言:[模式总览]——————————by xingoo 模式意图 享元模式,也叫[轻量级模式]或者[蝇量级模式].主要目的就是为了减少细粒度资源的消耗.比如,一个编辑器用到大量的字母数字和符号,但是 ...
- Linux中dpkg工具update-alternatives实现符号链接软件版本的切换(转)
一.功能作用 update-alternatives是dpkg的实用工具,用来维护系统命令的符号链接,以决定系统默认使用什么命令. 在Debian系统中,我们可能会同时安装有很多功能类似的程序和可选配 ...
- Gym - 101522H Hit!
H. Hit! time limit per test 1.0 s memory limit per test 256 MB input standard input output standard ...
- 【刷题】BZOJ 2001 [Hnoi2010]City 城市建设
Description PS国是一个拥有诸多城市的大国,国王Louis为城市的交通建设可谓绞尽脑汁.Louis可以在某些城市之间修建道路,在不同的城市之间修建道路需要不同的花费.Louis希望建造最少 ...
- 【bzoj1030】 JSOI2007—文本生成器
http://www.lydsy.com/JudgeOnline/problem.php?id=1030 (题目链接) 题意 给出$n$个单词,问有多少个长度为$m$的文本中至少包含一个单词. Sol ...