Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ushelp/easyshiro-redis-cache

基于 Redis 的 Shrio 缓存,支持 Jedis 直连和 Spring-Data-Redis RedisTemplate。An implement of redis cache can be used by shiro, Support Jedis direct connect and Spring-Data-Redis RedisTemplate.
https://github.com/ushelp/easyshiro-redis-cache

easyshiro easyshiro-redis-cache redis redis-cache redis-shiro redistemplate shiro shiro-redis shiro-redis-cache shiro-redis-session shiro-session

Last synced: about 1 month ago
JSON representation

基于 Redis 的 Shrio 缓存,支持 Jedis 直连和 Spring-Data-Redis RedisTemplate。An implement of redis cache can be used by shiro, Support Jedis direct connect and Spring-Data-Redis RedisTemplate.

Awesome Lists containing this project

README

        

# EasyShiro-Redis-Cache

基于 Redis 的 Shrio 缓存,支持 Jedis 直连和 Spring-Data-Redis RedisTemplate。

An implement of redis cache can be used by shiro, Support Jedis direct connect and Spring-Data-Redis RedisTemplate.

Thanks [shiro-redis](https://github.com/alexxiyang/shiro-redis).

## Featuter

- **中文**

1. 支持基于 Jdeis 直接配置 Redis 连接( `INI`, `XML`)

2. 支持与 Spring 集成时,使用 Spring-Data-Redis 的 `RedisTemplate` (`XML`)

3. 支持与
[EasyShiro](https://github.com/ushelp/EasyShiro 'EasyShiro') 集成

- **English**

1. Support direct configuration of Redis connection (`INI`,` XML`)

2. Support for integration with Spring-Data-Redis RedisTemplate (`XML`)

3. Support for integration
[EasyShiro](https://github.com/ushelp/EasyShiro 'EasyShiro')

## Maven

```XML

cn.easyproject
easyshiro-redis-cache
2.6.0-RELEASE

```

## Configure

### RedisManager(Jedis)

- shiro.ini

```properties
#redisManager
redisManager = cn.easyproject.shirorediscache.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, 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 = cn.easyproject.shirorediscache.RedisSessionDAO
redisSessionDAO.redisManager = $redisManager
#optional, default value:0, never expire. The expire time is in second
redisSessionDAO.expire = 1800

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager

sessionManager.sessionDAO = $redisSessionDAO
securityManager.sessionManager = $sessionManager


#============redisCacheManager===========
cacheManager = cn.easyproject.shirorediscache.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
```

- shiro.xml

```xml











/login.jsp = anon
/user/** = anon
/register/** = anon
/unauthorized.jsp = anon
/css/** = anon
/js/** = anon

/** = authc











































```

### Spring-Data-Redis RedisTemplate

- shiro.xml

RedisTemplate key is must `StringRedisSerializer`.

```XML
















































/login.jsp = anon
/user/** = anon
/register/** = anon
/unauthorized.jsp = anon
/css/** = anon
/js/** = anon

/** = authc




































```

> NOTE
> EasyShiro-Redis-Cache 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.

## End

Email:

[http://www.easyproject.cn](http://www.easyproject.cn "EasyProject Home")

**Donation/捐助:**



<br />支付宝/微信/QQ/云闪付/PayPal 扫码支付

支付宝/微信/QQ/云闪付/PayPal


我们相信,每个人的点滴贡献,都将是推动产生更多、更好免费开源产品的一大步。

**感谢慷慨捐助,以支持服务器运行和鼓励更多社区成员。**

We believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step.

**Thank you donation to support the server running and encourage more community members.**