CacheManager properties set - Apache Shiro

How to set cacheManager properties using Apache siro. When debugging, I get INFO,

80104 [ 1045903843@qtp-967078155-3 ] INFO org.apache.shiro.realm.AuthorizingRealm - No cache or cacheManager properties have been set. Authorization cache cannot be obtained. 

I am using JSF2 and Google Cloud SQL.

+7
source share
2 answers

If you use the Shiro INI configuration, you set the cacheManager SecurityManager property like any other bean property. For example:

 [main] cacheManager = com.something.impl.SomeCacheManager # config cacheManager as necessary, eg # cacheManager.foo = bar securityManager.cacheManager = $cacheManager 

You can use the ready-made EhCacheManager or implement the CacheManager and Cache interfaces yourself to use a specialized backup storage (for example, Memcache, Coherence, GigaSpaces, any modern NoSQL key / value store, etc ...)

+4
source

It seems that EhCacheManager is not part of shiro-core 1.2.1 (in any case in the Maven package). I solved the problem by adding the following to my [main] section in the shiro.ini file:

 [main] builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager securityManager.cacheManager = $builtInCacheManager 
+1
source

All Articles