Apache Shiro Infinispan cache support
Shiro's default configuration native SessionManagers use in-memory-only Session storage. This is unsuitable for most production applications.
Shiro provides EHCache support for session management.
This project is drop-in replacement that uses Infinispan data grid cache.
Configuring Infinispan cache for all of Shiro's caching needs in shiro.ini
[main]
...
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager
cacheManager = com.github.zbiljic.shiro.cache.infinispan.InfinispanCacheManager
securityManager.cacheManager = $cacheManager
...
Default infinispan.xml
configuration uses Infinispan's Distribution mode with 2 cluster wide copies of cache entries. Transport configuration used is jgroups-tcp.xml
.
Infinispan JMX statistics are enabled by default.
You can use provided infinispan.xml
as a starting point for custom Infinispan configuration. Check Infinispan User Guide for configuration options.
After that, configure cache manager in shiro.ini
so that it points to the location of your custom XML configuration file.
Example:
[main]
...
cacheManager = com.github.zbiljic.shiro.cache.infinispan.InfinispanCacheManager
cacheManager.cacheManagerConfigFile = "config/custom_infinispan.xml"
securityManager.cacheManager = $cacheManager
...
Please open an issue
This code is licensed under the MIT License.