shiro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lenny Primak <lpri...@hope.nyc.ny.us>
Subject Re: Get SecurityManager in a mixed web app
Date Mon, 16 Nov 2015 00:47:26 GMT
You need to bind the SecurityManager to thread context before using Shiro.
 >>> ThreadContext.bind(securityManager);

and you will need get security manager from somewhere via SpringBoot initialization

> On Nov 15, 2015, at 5:23 PM, mgiammarco <mgiammarco@gmail.com> wrote:
> 
> Hello,
> I have a spring-boot web app that provides some jsp pages and uses
> websockets.
> I have configured shiro correctly for web use.
> But now when I use in the spring websocket part:
> 
> Subject.Builder().sessionId("token").buildSubject();
> 
> I get:
> 
> 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
> 
> and SecurityUtils.getSubject() returns null
> 
> Obviously this happens because I cannot get the web SecurityManager from
> non-web thread.
> 
> But I need badly to access that SecurityManager from all threads. 
> How can I do it?
> 
> 
> Thanks,
> Mario
> 
> 
> 
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Get-SecurityManager-in-a-mixed-web-app-tp7580849.html
> Sent from the Shiro User mailing list archive at Nabble.com.
> 


Mime
View raw message