You can get it from the SecurityManager:

((RealmSecurityManager)securityManager).getRealms().  You can find your
realm by name (realm.getName()) and do what you like.  The SecurityManager
is generally available via SecurityUtils.getSecurityManager().

But maybe a better way to do this would be to have your Realm implementation
be an event listener - other components can trigger an event when you need
to clear the authz cache, and your realm implementation can automatically
clear the cache when it receives those events.

Anyway, either approach will work - I'm just throwing out ideas ;)

HTH,

Les

On Tue, Jul 6, 2010 at 4:05 PM, barmstrong <[email protected]> wrote:

>
> I want to be able to clear the authorization cache if certain things
> happen.
> (A user's roles change, for example.)
>
> I am defining my realm in shiro.ini:
>
> myRealm = com.so.on.so.forth.AuthZRealm;
>
> How do I get access to this object from within my application so that I can
> clear the cache?
>
> Thanks!
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Getting-Access-to-Shiro-Realm-instantiated-in-shiro-ini-Cache-tp5262817p5262817.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Reply via email to