Hi all,
I'm using Shiro for a command line application. I'm instantiating the
SecurityManager exactly how it is specified on the wiki:
Factory factory = new IniSecurityManagerFactory("classpath:shiro.ini");
SecurityManager securityManager = factory.getInstance();
SecurityUtils.setSecurityManager(securityManager);
After authenticating a user, a new thread is spawned. Seems to be related to
the default session management code. The problem I have is that this thread
is never stopped, and so my command line never exists.
I've found that the solution is to invoke destroy on the SecurityManager
instance. Since the method isn't part of the SecurityManager hierarchy, I've
delegated the call to the LifecycleUtils class:
LifecycleUtils.destroy(SecurityUtils.getSecurityManager());
This works fine, but I'm wondering if this is the suggested/correct pattern.
It wasn't obvious, I had to inspect Shiro code. What's the recommended
approach?
Thanks,
Philippe
--
View this message in context:
http://n2.nabble.com/Shutting-down-Shiro-tp4471207p4471207.html
Sent from the Shiro User mailing list archive at Nabble.com.