shiro整合thymeleaf
1、引入依赖
<!--thymeleaf中使用shiro-->
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>2.0.0</version>
</dependency>
2、ShiroConfig中编写shiroDialect
@Bean(name = "shiroDialect")
public ShiroDialect shiroDialect(){
return new ShiroDialect();
}
3、html页面添加xmlns
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
4、在标签中使用shiro标签
<div shiro:hasPermission="add">
<a href="/1">1111</a>
</div> <div shiro:hasPermission="update">
<a href="/2">2222</a>
</div> <div shiro:hasPermission="all">
<a href="/1">1111</a>
<a href="/2">2222</a>
</div>
注:根据不同权限某些功能进行隐藏和展示:
如:admin账号具有最大权限,则可以看到所有功能

zhangsan具有修改权限,则只能看到修改按钮

lisi具有增加权限,则只能看到增加按钮
shiro整合thymeleaf的更多相关文章
- shiro学习(五、springboot+shiro+mybatis+thymeleaf)
入门shiro(感觉成功了)首先感谢狂神,然后我就一本正经的复制代码了 项目结构 运行效果 数据库 <dependencies> <!-- thymeleaf-shiro整合包 -- ...
- Spring Boot 2.x 综合示例-整合thymeleaf、mybatis、shiro、logging、cache开发一个文章发布管理系统
一.概述 经过HelloWorld示例(Spring Boot 2.x 快速入门(上)HelloWorld示例)( Spring Boot 2.x 快速入门(下)HelloWorld示例详解)两篇的学 ...
- SpringBoot与Shiro整合权限管理实战
SpringBoot与Shiro整合权限管理实战 作者 : Stanley 罗昊 [转载请注明出处和署名,谢谢!] *观看本文章需要有一定SpringBoot整合经验* Shiro框架简介 Apach ...
- Shiro 整合SpringMVC 并且实现权限管理
Apache Shiro是Java的一个安全框架.目前,使用Apache Shiro的人越来越多,因为它相当简单,对比Spring Security,可能没有Spring Security做的功能强大 ...
- Shiro 整合SpringMVC 并且实现权限管理,登录和注销
Apache Shiro是Java的一个安全框架.目前,使用Apache Shiro的人越来越多,因为它相当简单,对比Spring Security,可能没有Spring Security做的功能强大 ...
- shiro整合ehcache
目标:让Shiro整合ehcache,提供缓存realm数据的功能. 1.引入encache配置文件,配置缓存 <!-- <ehcache xmlns:xsi="http://w ...
- SpringBoot 同时整合thymeleaf html、vue html和jsp
问题描述 SpringBoot如何同时访问html和jsp SpringBoot访问html页面可以,访问jsp页面报错 SpringBoot如何同时整合thymeleaf html.vue html ...
- 【Springboot】Springboot整合Thymeleaf模板引擎
Thymeleaf Thymeleaf是跟Velocity.FreeMarker类似的模板引擎,它可以完全替代JSP,相较与其他的模板引擎,它主要有以下几个特点: 1. Thymeleaf在有网络和无 ...
- springboot 与 shiro 整合 (简洁版)
前言: 网上有很多springboot 与 shiro 整合的资料,有些确实写得很好, 对学习shiro和springboot 都有很大的帮助. 有些朋友比较省事, 直接转发或者复制粘贴.但是没有经过 ...
随机推荐
- direct2d: antialiasing and drawing a line with a 1 pixel stroke
http://xboxforums.create.msdn.com/forums/t/61448.aspx I'm currently porting a number of custom MFC C ...
- Mysql语法:navicat for mysql 添加注释
在 navicat 中有三种注释的书写方式: 以 # 开头的字符串,可以多个 # 连续以 – 开头的字符串,注意:只能是 – ,而且 – 后面需要加一个半角空格以 /* */ 包围的字符串,类似于 J ...
- PIC c语言
rom类型,对于占内存的类型定义为rom类型,跟标准c中的const不一样,const跟rom不能通用,否则编译会报type qualifier dismatch 有些变量定义成了rom型,那么如果改 ...
- 优动漫PAINT画树教程
依次解析画树要点!让画树不再是难事~ 优动漫PAINT下载:http://wm.makeding.com/iclk/?zoneid=18597
- vue的表格加单选框
https://www.cnblogs.com/calamus/p/8569196.html
- kissy延迟加载demo
<!doctype html><html><head> <meta charset="gbk"/> <title& ...
- 被我忽略许久的set
心塞,set一直是我忽略的一个数据结构 1.生成一个set: 1) set(iterable) 传入一个可以迭代的数据结构: eg:字符串;元组;列表,字典 2) {v1,v2,.......,vn} ...
- 小程序QQ版表情解析组件
代码片段: [https://developers.weixin.qq.com/s/KLaD5MmD7V45) GitHub: https://github.com/WozHuang/Miniprog ...
- Django中ORM介绍和字段
ORM介绍 ORM概念 对象关系映射(Object Relational Mapping,简称ORM)模式是一种为了解决面向对象与关系数据库存在的互不匹配的现象的技术. 简单的说,ORM是通过使用描述 ...
- 【codeforces 553C】Love Triangles
[题目链接]:http://codeforces.com/problemset/problem/553/C [题意] 给你n个点,m条边; 每种边有2两种类型; 让你补充剩下的边,构造一个完全图; 使 ...