springboot +security +mybatis+thymeleaf 实现简单的用户 角色 权限(资源) 管理

1、用户 角色 资源的关系

2、实现思路

3、参考资料

Spring Boot Security   +Redis 实现简单权限控制

将返回结果变成json 响应改客户端    在第六项 

 

4、实现代码

 

https://github.com/huyande/springsecurity.git

 

5、其他问题记录  

在使用springboot 2.1.X 版本 ,使用 thymeleaf-extras-springsecurity4 部分页面的标签会失效 ,创建项目时使用2.0.x的Springboot。 

 


6、其他 

  • sec:authorize="isAuthenticated()":是否授权成功
  • sec:authentication="principal.authorities":获取用户身份
  • sec:authentication="name":获取用户名字
  • sec:authorize="hasRole()":判断当前身份

 

两个用户 

用户名 密码
zhangsan zhangsan
lisi zhangsan

 

posted @ 2019-02-24 22:39  yinder  阅读(901)  评论(0编辑  收藏  举报