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 | @goStormpath | 888.391.5282


On Thu, Nov 14, 2013 at 6:41 AM, Eric Stein <[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]
> 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