{"repo":"dolyw/ShiroJwt","free":true,"listed":false,"github":"https://github.com/dolyw/ShiroJwt","clone":"git clone https://github.com/dolyw/ShiroJwt.git","description":"API SpringBoot + Shiro + Java-Jwt + Redis(Jedis)","language":"Java","stars":688,"topics":["shiro","redis","jwt","spring-boot","redis-refreshtoken","mysql","vue","element-ui"],"license":"MIT","category":"databases-storage","readme_excerpt":"ShiroJwt 前端地址:https://github.com/wang926454/VueStudy/tree/master/VueStudy08-JWT 疑问查看 1. #14 重复请求会不会生成多个token 2. #19 跨域sso问题 3. #29 Token刷新并发处理 有疑问请扫码加 QQ 群交流: 779168604 项目相关 JavaDoc:https://apidoc.gitee.com/dolyw/ShiroJwt 接口文档:https://note.dolyw.com/shirojwt/ShiroJwt-Interface.html 教程目录:https://note.dolyw.com/shirojwt 改为数据库形式(MySQL):https://note.dolyw.com/shirojwt/ShiroJwt02-MySQL.html 解决无法直接返回401错误:https://note.dolyw.com/shirojwt/ShiroJwt03-401.html 实现Shiro的Cache(Redis)功能:https://note.dolyw.com/shirojwt/ShiroJwt04-Redis.html 项目介绍 1. RESTful API 2. Maven集成Mybatis Generator(逆向工程) 3. Shiro + Java-JWT实现无状态鉴权机制(Token) 4. 密码加密(采用AES-128 + Base64的方式) 5. 集成Redis(Jedis) 6. 重写Shiro缓存机制(Redis) 7. Redis中保存RefreshToken信息(做到JWT的可控性) 8. 根据RefreshToken自动刷新AccessToken 关于Shiro + Java-JWT实现无状态鉴权机制(Token) 1. 首先 Post 用户名与密码到 user/login 登入，成功返回加密的 AccessToken ，失败直接返回401错误(帐号或密码不正确) 2. 以后访问都带上这个 AccessToken 即可 3. 鉴权流程主要是重写了 Shiro 的入口过滤器 JWTFilter ( BasicHttpAuthenticationFilter )，判断请求 Header 里面是否包含 Authorization 字段 4. 有就进行 Shiro 的 Token 登录认证授权(用户访问每一个需要权限的请求必须在 Header 中添加 Authorization 字段存放 AccessToken )，没有就以游客直接访问(有权限管控的话，以游客访问就会被拦截) 关于AES-128 + Base64当两个用户的明文密码相同时进行加密，会发现数据库中存在相同结构的暗文密码 大部分是以 MD5 + 盐 的形式解决了这个问题(详细自己百度)，我采用 AES-128 + Base64 是以帐号+密码的形式进行加密密码，因为帐号具有唯一性，所以也不会出现相同结构的暗文密码这个问题 关于将Jedis工具类与SpringBoot整合 本来是直接将 JedisUtil 注入为 Bean ，每次使用直接 @Autowired 注入使用即可，但是在重写 Shiro 的 CustomCache 无法注入 JedisUtil ，所以就改成静态注入 JedisPool连接池 ， JedisUtil工具类 还是直接调用静态方法，无需 @Autowired 注入 关于Redis中保存RefreshToken信息(做到","default_branch":null,"files":null,"tree":[],"storefront":"/r/dolyw","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dolyw/ShiroJwt/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}