8:Spring Boot中thymeleaf模板中使用 Shiro标签

时间:2019-07-09 22:21:02   收藏:0   阅读:366

1,添加

pom.xml

技术分享图片

grade:

compile(‘com.github.theborakompanioni:thymeleaf-extras-shiro:1.2.1‘)

 

2, 

Subject subject = SecurityUtils.getSubject();
Users users = (Users) subject.getPrincipals();
this.request.getSession().setAttribute("userName", Utils.getUser(this.request).getUsername());



3.使用
th:text="‘fff:‘+${users.name}"
<shiro:hasRole>
<shiro:hasRole name="admin">
  </shiro:hasRole>
</shiro:hasRole>

技术分享图片

 





原文:https://www.cnblogs.com/gzhbk/p/11160813.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!