# shiro-redis **Repository Path**: git654321/shiro-redis ## Basic Information - **Project Name**: shiro-redis - **Description**: Fork https://github.com/alexxiyang/shiro-redis - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://git.oschina.net/baayso/shiro-redis - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2015-08-14 - **Last Updated**: 2020-12-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shiro-redis shiro only provide the support of ehcache and concurrentHashMap. Here is an implement of redis cache can be used by shiro. Hope it will help you! How to use it? =========== You can choose these 2 ways to include shiro-redis into your project * use "git clone https://github.com/alexxiyang/shiro-redis.git" to clone project to your local workspace and build jar file by your self * add maven dependency How to configure ? =========== You can choose 2 ways : shiro.ini or spring-*.xml shiro.ini: ```properties #redisManager redisManager = com.baayso.shiro.redis.RedisManager #optional if you don't specify host the default value is 127.0.0.1 redisManager.host = 127.0.0.1 #optional , default value: 6379 redisManager.port = 6379 #optional, default value:0 .The expire time is in second redisManager.expire = 30 #optional, timeout for jedis try to connect to redis server(In milliseconds), not equals to expire time! redisManager.timeout = 0 #optional, password for redis server redisManager.password = #============redisSessionDAO============= redisSessionDAO = com.baayso.shiro.redis.RedisSessionDAO redisSessionDAO.redisManager = $redisManager sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager sessionManager.sessionDAO = $redisSessionDAO securityManager.sessionManager = $sessionManager #============redisCacheManager=========== cacheManager = com.baayso.shiro.redis.RedisCacheManager cacheManager.redisManager = $redisManager #custom your redis key prefix, if you doesn't define this parameter shiro-redis will use 'shiro_redis_session:' as default prefix cacheManager.keyPrefix = users:security:authz: securityManager.cacheManager = $cacheManager ``` spring.xml: ```xml /login.jsp = anon /user/** = anon /register/** = anon /unauthorized.jsp = anon /css/** = anon /js/** = anon /** = authc ``` > NOTE > Shiro-redis don't support SimpleAuthenticationInfo created by this constructor `org.apache.shiro.authc.SimpleAuthenticationInfo.SimpleAuthenticationInfo(Object principal, Object hashedCredentials, ByteSource credentialsSalt, String realmName)`. > Please use `org.apache.shiro.authc.SimpleAuthenticationInfo.SimpleAuthenticationInfo(Object principal, Object hashedCredentials, String realmName)` instead.