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 都有很大的帮助. 有些朋友比较省事, 直接转发或者复制粘贴.但是没有经过 ...
随机推荐
- Android PullToRefreshListView设置各个item之间的间距
要设置第三方的上拉下载listView的item之间的间距,可以在xml布局文件中的listView节点中设置xml的属性即可: android:divider="#00000000&quo ...
- MySQL学习(三)——Java连接MySQL数据库
1.什么是JDBC? JDBC(Java DataBase Connectivity)就是Java数据库连接,说白了就是用Java语言来操作数据库.原来我们操作数据库是在控制台使用SQL语句来操作数据 ...
- 读 Real-Time Rendering 收获 - chapter 6. texturing
Texturing, at its simplest, is a techinique for efficiently modeling the surface's properties.
- STM8S103之时钟设置
最大时钟(指的是system clock):外部晶振24MHz,内部高速RC16MHz 三个时钟源:外部晶振.内部高速RC(上电默认) +内部低速RC 几个时钟:master clock(即sytem ...
- POJ 2739 Sum of Consecutive Prime Numbers【素数打表】
解题思路:给定一个数,判定它由几个连续的素数构成,输出这样的种数 用的筛法素数打表 Sum of Consecutive Prime Numbers Time Limit: 1000MS Memo ...
- SpringCloud学习笔记(3)----Spring Cloud Netflix之深入理解Eureka
1. Eureka服务端的启动过程 1.1 入口类EurekaServerInitializerConfiguration类, public void start() { (new Thread(n ...
- 《Unix环境高级编程》读书笔记 第10章-信号
1.引言 信号是软件中断. 信号提供了一种处理异步事件的方法. 2. 信号概念 信号的名字都是以3个字符SIG开头. Linux3.2.0支持31种信号.FreeBSD.Linux和Solaris作为 ...
- Github上值得关注的前端项目-转自好友trigkit4
http://microjs.com/# 该网站的资源都托管到了github,microjs.com是一个可以让你选择微型的js类库的网站,该网站里的js库都是压缩后不大于5KB的,非常实用 http ...
- linux 删除命令注意事项(大神勿看)
在做软连接的时候,想到一个问题,如果删除软连接,会不会删除源文件. 如果删除是真删除的话,一旦操作错误那就后悔去吧. 效果是这样的:#rm -rf pp/ 如果pp是软连文件夹,那么 ...
- redhat7.5 升级OpenSSH_7.8p1
1:拷贝编译好rpm安装包 [root@liwm ~]# scp -r root@192.168.31.130:/home/openssh7.8 /home/ root@192.168.31.130' ...