Hi Les, thanks for this ... as you say, it does do it automatically. Not sure exactly why I thought otherwise.
I have some further questions/issues, but will raise in another thread. Cheers Dan On 3 January 2013 17:51, Les Hazlewood <[email protected]> wrote: > Hi Dan, > > The ShiroFilter already does this automatically - it is core to how > Shiro's current web support functions. Here's the code: > > > https://github.com/apache/shiro/blob/trunk/web/src/main/java/org/apache/shiro/web/servlet/AbstractShiroFilter.java#L362 > > The subject.execute call on line 362 will automatically bind the current > subject to the thread - via the ThreadContext - and then auto unbind from > the thread after the filter chain executes. > > There is some more information about how this works here: > http://shiro.apache.org/subject.html under "Thread Association". > > I hope that helps! > > Best, > > -- > Les Hazlewood | @lhazlewood > CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282 > Stormpath wins GigaOM Structure Launchpad Award! http://bit.ly/MvZkMk > > > On Thu, Jan 3, 2013 at 9:27 AM, Dan Haywood > <[email protected]>wrote: > >> >> I'm sure this is an easy one... >> >> I'm using Shiro 1.2.1 in a web context (integrating into Apache Isis [1]) >> with org.apache.shiro.web.env.EnvironmentLoaderListener and ShiroFilter. >> >> I want my app/framework to pick up the SecurityManager and Subject from >> SecurityUtils, by way of the ThreadContext. >> >> Is there a way to have ShiroFilter populate the ThreadContext? >> >> At the moment, I'm writing my own filter that grabs the WebEnvironment >> and then calls ThreadContext.bind(...). Feels a bit overkill to do this, >> though. >> >> Many thanks! >> Dan >> >> committer, Apache Isis >> >> [1] http://isis.apache.org >> >> >> >
