Les,
  Thanks for getting back to me. The thing is, I'd need either:
(a) one entry point into my API to make sure the INI load happens before the 
user tries to access anything, or
(b) a check at every entry point to make sure the ...

I was hoping that there was a hook in SecurityUtils that might scan for an INI 
when *it* gets pulled in by the classloader, but it sounds like that doesn't 
exist right now.
I'll muddle something out.

Thanks,
Eric

P.S. Good luck with Stormpath. I've seen a couple of your REST talks online, 
and I liked them a lot.


From: Les Hazlewood [mailto:[email protected]]
Sent: Tuesday, November 19, 2013 2:39 AM
To: [email protected]
Subject: Re: Load INI file on startup?

The Shiro quickstart is a simple command line application (main method) that 
creates a SecurityManager based off an INI file:

http://shiro.apache.org/10-minute-tutorial.html

Something needs to explicitly load the INI file to set up the Shiro environment 
before it can be used.  But you can lazily do this via a static class block in 
your library:

public class Something {

    static {
        //do Shiro init stuff here
    }
}

When the classloader loads your library class, it will init Shiro when it loads 
the class.  No method call necessary.

HTH,

--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com<http://stormpath.com/> | @goStormpath | 
888.391.5282

On Thu, Nov 14, 2013 at 6:41 AM, Eric Stein 
<[email protected]<mailto:[email protected]>> wrote:
So just to confirm, this is not possible? That means if I have a non-web API 
which uses Shiro, it needs a single entry point so that I can configure Shiro 
before the user does anything.

Thanks,
Eric

-----Original Message-----
From: Eric Stein
Sent: Friday, November 08, 2013 11:40 AM
To: [email protected]<mailto:[email protected]>
Subject: Load INI file on startup?

Is there a way for a non-web Shiro installation to load itself from an INI file 
on startup, similar to the way log4j and slf4j operate? I'm trying to avoid 
forcing my library's clients to have to make an explicit call into my API to 
spin up Shiro.

Thanks,
Eric

Reply via email to