1. 引入 Maven 依赖
- <!-- shiro-spring -->
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-spring</artifactId>
- <version>1.4.0</version>
- </dependency>
2. 用户认证和授权
A. 定义一个 ShiroConfig 配置类, 然后配置安全管理器 Bean(SecurityManager), 用于管理 Subject;
B. 在 ShiroConfig 中配置过滤器工厂 Bean(ShiroFilterFactoryBean), 依赖于 SecurityManager;
C. 自定义 Realms 实现类, 重写 doGetAuthenticationInfo() 和 doGetAuthorizationInfo() 方法;
可参考: SpringBoot Shiro 认证授权会话缓存 https://mrbird.cc/tags/Spring-Boot/page/2/
使用 Shiro 安全管理 https://www.dalaoyang.cn/article/49
轻松搞定 Shrio 安全框架
来源: http://www.bubuko.com/infodetail-3320986.html