thymeleaf-extras-shiro
2017-10-21 11:48
141 查看
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.
Repositorygit 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
guesttag
<p shiro:guest=""> Please <a href="login.html">Login</a> </p>The
usertag
<p shiro:user=""> Welcome back John! Not John? Click <a href="login.html">here<a> to login. </p>The
authenticatedtag
<a shiro:authenticated="" href="updateAccount.html">Update your contact information</a>The
notAuthenticatedtag
<p shiro:notAuthenticated=""> Please <a href="login.html">login</a> in order to update your credit card information. </p>The
principaltag
<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.
ThehasRoletag
<a shiro:hasRole="administrator" href="admin.html">Administer the system</a>The
lacksRoletag
<p shiro:lacksRole="administrator"> Sorry, you are not allowed to administer the system. </p>The
hasAllRolestag
<p shiro:hasAllRoles="developer, project manager"> You are a developer and a project manager. </p>The
hasAnyRolestag
<p shiro:hasAnyRoles="developer, project manager, administrator"> You are a developer, project manager, or administrator. </p>The
hasPermissiontag
<a shiro:hasPermission="user:create" href="createUser.html">Create a new User</a>The
lacksPermissiontag
<p shiro:lacksPermission="user:delete"> Sorry, you are not allowed to delete user accounts. </p>The
hasAllPermissionstag
<p shiro:hasAllPermissions="user:create, user:delete"> You can create and delete users. </p>The
hasAnyPermissionstag
<p shiro:hasAnyPermissions="user:create, user:delete"> You can create or delete users. </p>
相关文章推荐
- shiro与thymeleaf结合使用时,前台shiro标签没有生效
- springboot+shiro实现登录系数限定,thymeleaf中使用shiro标签
- spring mvc + shiro +thymeleaf 扩展使用shiro tags页面标签
- Spring 4 mvc+shiro+thymeleaf+JPA(Hibernate)+MySql eclipse项目模板
- spring boot+mybatis+thymeleaf+apache shiro开发面向学习型的后台管理系统BootDo
- thymeleaf模板整合shiro标签
- shiro spring boot thymeleaf
- spring boot 使用thymeleaf 和shiro标签整合
- [置顶] 【一】Springboot+Shiro+Mybatis+Thymeleaf实现权限控制和gif验证
- Spring boot项目整合thymeleaf和shiro
- thymeleaf+shiro 标签使用
- thymeleaf模板引擎shiro集成框架
- springboot项目,thymeleaf整合shiro
- 手工配置springboot + spring security + thymeleaf + thymeleaf-extras-springsecurity
- springboot thymeleaf和shiro 整合——按钮可见性
- springboot thymeleaf和shiro标签整合
- spring+thymeleaf+javabean简单交互数据
- shiro + cas 4.04 单点退出 注销
- 第十一章 Shiro缓存机制
- spring + shiro + cas 实现sso单点登录