Where is that method getting called from? Is it from the context of a request or while your application is starting ?
On Thu, Oct 27, 2016 at 7:02 PM, Harinath Mallepally <[email protected]> wrote: > Thanks for the response. > > I tried this way, but results in with error. any thoughts on how do I get > handle on this? It looks like something is wrong with configuration or so. > > private void setListener(){ > > try { > //TODO temp code, remove it > AuthenticatingSecurityManager securityMgr = > (AuthenticatingSecurityManager) > SecurityUtils.getSecurityManager(); > > System.out.println(securityMgr); > > AbstractAuthenticator authentication = (AbstractAuthenticator) > securityMgr.getAuthenticator(); > > authentication.getAuthenticationListeners().add(new > CustomAuthenticationListener()); > }catch(Exception e){ > LOG.error("error {}", e); > } > } > but resulted in with this > > error {} > org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager > accessible to the calling code, either bound to the > org.apache.shiro.util.ThreadContext > or as a vm static singleton. This is an invalid application configuration. > at org.apache.shiro.SecurityUtils.getSecurityManager( > SecurityUtils.java:123) > > ......... > > On Thu, Oct 27, 2016 at 12:55 PM, Brian Demers <[email protected]> > wrote: > >> I'm not sure, but if I had to guess, I would say you need to export your >> package in your bundles config >> >> On Thu, Oct 27, 2016 at 2:10 PM, Harinath Mallepally <[email protected]> >> wrote: >> >>> yes, I am using shiro.ini, my problem is my class is not being >>> identified in karaf (doing it with opendaylight), didn't know how to add my >>> class into classpath without modifying ODL feature. >>> >>> >>> >>> On Thu, Oct 27, 2016 at 8:13 AM, Brian Demers <[email protected]> >>> wrote: >>> >>>> I you are using a shiro.ini just stick your filter in the [main] >>>> section. >>>> >>>> For example: >>>> >>>> [main] >>>> ... >>>> myFilter = com.foo.bar.MyWickedCoolFilter >>>> >>>> [urls] >>>> /path/* = myFilter >>>> # or possibly >>>> /another/path/* = myFitler[anOption] >>>> >>>> >>>> >>>> >>>> On Wed, Oct 26, 2016 at 7:50 PM, Allan C. <[email protected]> wrote: >>>> >>>>> There's a SecurityUtils class that can access the static >>>>> SecurityManager object. >>>>> >>>>> Regards, >>>>> Allan C. >>>>> >>>>> On Thu, Oct 27, 2016 at 6:15 AM, Harinath Mallepally <[email protected] >>>>> > wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> is it possible to get reference of SecurityManager so that a custom >>>>>> AuthenticationFilter can be added? >>>>>> >>>>>> >>>>>> Please let me know >>>>>> >>>>>> Thanks >>>>>> Hari >>>>>> >>>>>> >>>>> >>>> >>> >> >
