Chris Geer wrote > We use Shiro in an OSGI environment just fine, but we did have to upgrade > to version 1.2.1 since there were some OSGI related fixes in that release. > The important thing to remember with OSGI is each bundle is in it's own > class loader so if you are just referencing Shiro from multiple bundles > you > will get unique instances. What we do is we have a single bundle that > initialized shiro and then exports the SecurityManager as an OSGI service > which our other bundles import and use. That way everything is using the > same SecurityManager instance.
I had a question, I init SecurityManager in one bundle(like xxx.service bundle), using Spring standalone applications configuration(from http://shiro.apache.org/spring.html), then I export SecurityManager as a OSGI service.But I wonder how other bundles use it.For example, I want to use SecurityManager in my ui web bundle, how do I init Shiro with that SecurityManager imported from xxx.service bundle? I had two questions, and wants some instructions from you. 1. bundle which want to use SecurityManager implements BundleActivator and init with code in start method like SecurityUtils.setSecurityManager(securityManager); in this way, is the securityManager accessible only in this bundle? And every bundle must add the code like this? 2. If a web bundle wants to use it, and init with spring like the "web applications" chapter in this page "http://shiro.apache.org/spring.html". What would I do? I appreciate your help. -- View this message in context: http://shiro-user.582556.n2.nabble.com/Apache-Shiro-in-an-OSGi-Environment-tp7578939p7579950.html Sent from the Shiro User mailing list archive at Nabble.com.
