You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by kreca <jo...@gmail.com> on 2009/06/30 18:42:07 UTC

Getting the default realm

Hi,
Im a new user of apache shiro. I've succesfully implemented shiro in our
application and we are very happy with it.

Now I'm trying to clear the cache for a certain principal when updating
credentials.

My problem is that I do not find a way to get the Realm from the web
application. 
Is there a way to retreive this through a static method?
What is the recommended approach of accessing it?

Im using spring so it would be possible to inject it I assume

Best regards
Jonas


-- 
View this message in context: http://n2.nabble.com/Getting-the-default-realm-tp3183739p3183739.html
Sent from the Shiro User mailing list archive at Nabble.com.


Re: Getting the default realm

Posted by Les Hazlewood <lh...@apache.org>.
That's an even better question ;)

On Tue, Jun 30, 2009 at 3:55 PM, Maarten Bosteels
<mb...@gmail.com>wrote:

>
>
> On Tue, Jun 30, 2009 at 7:31 PM, Les Hazlewood <lh...@apache.org>wrote:
>
>> Hi Jonas,
>>
>> You wouldn't necessarily use Shiro to do this - although you could - but
>> it would be Shiro implementation-specific and I wouldn't recommend it when
>> you're already using Spring, which provides nice lookup capabilities
>> already.
>>
>> If it is spring based, the easiest thing to do is just to acquire the
>> realm from the Spring application context:
>>
>>
>> WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("myRealm");
>>
>
> Why looking it up when you can just as well inject it ?
>
> Maarten
>

Re: Getting the default realm

Posted by Maarten Bosteels <mb...@gmail.com>.
On Tue, Jun 30, 2009 at 7:31 PM, Les Hazlewood <lh...@apache.org>wrote:

> Hi Jonas,
>
> You wouldn't necessarily use Shiro to do this - although you could - but it
> would be Shiro implementation-specific and I wouldn't recommend it when
> you're already using Spring, which provides nice lookup capabilities
> already.
>
> If it is spring based, the easiest thing to do is just to acquire the realm
> from the Spring application context:
>
>
> WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("myRealm");
>

Why looking it up when you can just as well inject it ?

Maarten


>
> Cheers,
>
> Les
>
>
> On Tue, Jun 30, 2009 at 12:42 PM, kreca <jo...@gmail.com> wrote:
>
>>
>> Hi,
>> Im a new user of apache shiro. I've succesfully implemented shiro in our
>> application and we are very happy with it.
>>
>> Now I'm trying to clear the cache for a certain principal when updating
>> credentials.
>>
>> My problem is that I do not find a way to get the Realm from the web
>> application.
>> Is there a way to retreive this through a static method?
>> What is the recommended approach of accessing it?
>>
>> Im using spring so it would be possible to inject it I assume
>>
>> Best regards
>> Jonas
>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Getting-the-default-realm-tp3183739p3183739.html
>> Sent from the Shiro User mailing list archive at Nabble.com.
>>
>>
>

Re: Getting the default realm

Posted by Les Hazlewood <lh...@apache.org>.
Hi Jonas,

You wouldn't necessarily use Shiro to do this - although you could - but it
would be Shiro implementation-specific and I wouldn't recommend it when
you're already using Spring, which provides nice lookup capabilities
already.

If it is spring based, the easiest thing to do is just to acquire the realm
from the Spring application context:

WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("myRealm");

Cheers,

Les

On Tue, Jun 30, 2009 at 12:42 PM, kreca <jo...@gmail.com> wrote:

>
> Hi,
> Im a new user of apache shiro. I've succesfully implemented shiro in our
> application and we are very happy with it.
>
> Now I'm trying to clear the cache for a certain principal when updating
> credentials.
>
> My problem is that I do not find a way to get the Realm from the web
> application.
> Is there a way to retreive this through a static method?
> What is the recommended approach of accessing it?
>
> Im using spring so it would be possible to inject it I assume
>
> Best regards
> Jonas
>
>
> --
> View this message in context:
> http://n2.nabble.com/Getting-the-default-realm-tp3183739p3183739.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>
>