You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by ashil_sec <as...@adp.com> on 2013/11/01 12:28:35 UTC

Shiro With Mongo DB

Can someone help me know if Shiro can work with MongoDB... Where we can
persist our realm and authorisation data and read it from there instead of
regular SQL DB.



--
View this message in context: http://shiro-developer.582600.n2.nabble.com/Shiro-With-Mongo-DB-tp7578182.html
Sent from the Shiro Developer mailing list archive at Nabble.com.

Re: Shiro With Mongo DB

Posted by Bruno Grieder <br...@amalto.com>.
We have not tried with MongoDB, but I guess any store where you can keep serialized data should do.

For the Session Cache, on the DefaultWebSessionManager (or your implementation) call setCache() with your own implementation of a CacheManager.

Your implementation of CacheManager must override the method public <K, V> Cache<K, V> getCache(String cacheName) throws CacheException to return your Cache implementation.

Your Cache implementation must handle the CRUD calls to either MongoDB or to a Memory Cache like EhCache, backed by MongoDB. Now you have to make sure that yourHttpSessions are serializable and I am not sure there may be any benefit to serialize them to JSON.

If you want to cache Authorization and Authentication infos, silly do the same on your implementation of the AuthorizingRealm