解决方法分为两种:1、关闭protected-mode模式 2、配置bind或者设置密码 #哨兵模式下的密码 spring.redis.password=123456 #哨兵的配置列表 (一般不修改的话,默认名字就是mymaster) spring.redis.sentinel.master=mymaster ##哨兵集群(这是哨兵ip) spring.redis.sentinel.nodes=39.107.119.254:26379,39.107.119.254:2638...
packagewebapp.controller;importorg.apache.shiro.SecurityUtils;importorg.apache.shiro.authc.UsernamePasswordToken;importorg.apache.shiro.session.Session;importorg.apache.shiro.subject.PrincipalCollection;importorg.apache.shiro.subject.Subject;importorg.springframework.beans.factory.annotation.Autowired;importorg.sprin...
@EnableConfigurationProperties({RedisProperties.class})publicclassShiroConfig{privateRedisProperties redis;publicShiroConfig(RedisProperties redis){this.redis=redis;}@BeanpublicUserRealmuserRealm(){returnnewUserRealm();}@BeanpublicShiroFilterFactoryBeanshiroFilterFactoryBean(SecurityManager securityManager){ShiroFilte...
publicRedisManager(RedisProperties redis) { this.redis = redis; } privatevoidinit() { synchronized(this) { if(this.jedisPool ==null) { this.jedisPool =newJedisPool(this.getJedisPoolConfig(), redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(), redis.getDatabase()...
public class RedisProperties { private String host; private int port; private int timeout; private String password; private int database; } 配置ShiroConfig: /** * Shiro权限配置 * 一定要配置 @Configuration 和 @EnableConfigurationProperties 注解 ...
1.Maven 依赖引入shiro-spring-boot-web-starter 2.Shiro 的基本配置 3.Maven 依赖引入 spring-boot-starter-data-redis 4.针对集群共享需要进行的Shiro 扩展 5.集群共享Session下的单用户登录 1.Maven 依赖引入shiro-spring-boot-web-starter 编辑pom.xml文件 ...
参数配置RedisProperties: @Data @ConfigurationProperties(prefix = "redis") public class RedisProperties { private String host; private int port; private int timeout; private String password; private int database; } 配置ShiroConfig: /** * Shiro权限配置 ...
使用redis集中存储,实现分布式集群共享用户信息,这里我们采用第三方开源插件crazycake来实现,pom.xml引入: <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.crazycake</groupId><artifactId>shiro-redis</artifact...
<dependency> <groupId>org.crazycake</groupId> <artifactId>shiro-redis</artifactId> <version>2.4.2.1-RELEASE</version> </dependency> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>org.apache...
springboot 应用场景 redis springboot shiro redis 主要记录关键和有坑的地方 前提: 1、SpringBoot+shiro已经集成完毕,如果没有集成,先查阅之前的Springboot2.0 集成shiro权限管理 2、redis已经安装完成 3、redis客户端使用Lettuce,这也是sprinboot2.0后默认的,与jedis的区别,自行百度...