coder-yqj / springboot-shiro Goto Github PK
View Code? Open in Web Editor NEW使用SpringBoot与shiro实现基于数据库的细粒度动态权限管理系统实例
使用SpringBoot与shiro实现基于数据库的细粒度动态权限管理系统实例
我这这边试了一下是没有问题的。但是发现几个问题:
首先你的项目存在重复依赖:
<dependency> <groupId>org.crazycake</groupId> <artifactId>shiro-redis</artifactId> <version>2.4.2.1-RELEASE</version> <exclusions> <exclusion> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> </exclusion> </exclusions> </dependency>
shiro-core又有两个版本,应为spring-shiro也有该依赖。而且clearCachedAuthorizationInfo是protected的,所以直接调用是无法编译的。
应当把清除redis缓存的方法移到MyShiroRealm,然后将这个实例注入到Service更新权限的时候调用清除缓存。改下这两个地方我这边该更权限就能及时生效了。
在redis里直接可以观测到key的变化:
更改了权限,不操作界面:
`127.0.0.1:6379> keys **
重新访问菜单:
`
127.0.0.1:6379> keys **
你用的编译器是idea嘛,idea好像在动态权限管理查询哪里,会报空指针异常吧。注入不进去
大佬你好,看了你的博客受益匪浅,在此先谢过,另外问一下,注册的时候密码是通过 pwd+sale 然后再md5加密的,然后看了你的代码发现PasswordHelper 加密的方法没有用到salt,用的是new SimpleHash();看了下源码构造函数,SimpleHash(String algorithmName, Object source, Object salt, int hashIterations) 如果我要是加salt的话是不是直接再构造里面传入salt就好了呢?一直找到源码深处 hash方法 protected byte[] hash(byte[] bytes, byte[] salt, int hashIterations) 没太看明白。。。。。
关键问题是 doGetAuthenticationInfo 方法中new SimpleAuthenticationInfo()传入的参数中并不知道这个salt从哪里加进去呀,希望大佬留个qq 请教,大榭
楼主,为什么我在ShiroConfig中ResourcesService不能初始化呢,下面用的时候会报空指针。
这个怎么处理
这个框架不错
修改了ShiroConfigurer类中的缓存时间,但发现无法控制登录后的session有效时间。半小时会自动退出登录 请问应该在何处设置?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.