Hi Scott,

The example I wrote already creates the Runnable instance as an
anonymous inner class.  Or you could use a Callable in the same way if
you need to react to an exception or return a value.

Don't worry about the ThreadState stuff - that is a mechanism that you
probably don't need.  The "Automatic Association" section in the wiki
page (http://cwiki.apache.org/confluence/display/SHIRO/Subject) shows
example code that will work and is easier to deal with.

That is:

subject.execute( new Runnable() {
   public void run() {
       doBootstrap();
   }
});

private void doBootstrap() {
   //do work here as the user
}

Cheers,

Les

On Thu, Oct 29, 2009 at 11:49 AM, Scott Ryan <[email protected]> wrote:
> That is the direction i am going. I just need to figure out how to create
> the runnable since it is an interface.  I am close so hope to publish a good
> solution later today.
>
> Scott Ryan
> President/CTO
> Soaring Eagle L.L.C.
> [email protected]
> (303) 263-3044
>
> On Oct 29, 2009, at 9:35 AM, Peter Ledbrook wrote:
>
>>> Yes I think it is not running in a request/response mode.  Just a dumb
>>> question as i implement your solution.  I tried this earlier but since
>>> Runnable is an interface it does not let me create one so I must be
>>> missing
>>> a parenthesis or something?
>>
>> Correct, BootStrap is executed during servlet context startup, so
>> there is not request or response.
>>
>>> I will try out your suggestions and offer feedback.  I think it would be
>>> nice to have access to both security managers from the plugin so you
>>> could
>>> use the same code during both processes.
>>
>> The BootStrap instances are auto-wired by Spring, so you have access
>> to the Spring application context. I would consider grabbing the
>> "shiroSecurityManager" bean and copying the realms from there into
>> your own temporary (non-web) security manager. I say copy the realms,
>> but I mean the references to them.
>>
>> That's if you even need the realms.
>>
>> Cheers,
>>
>> Peter
>
>

Reply via email to