Class IniWebEnvironment

    • Method Detail

      • init

        public void init()
        Initializes this instance by resolving any potential (explicit or resource-configured) Ini configuration and calling configure for actual instance configuration.
        Specified by:
        init in interface Initializable
      • getFrameworkIni

        protected Ini getFrameworkIni()
        Extension point to allow subclasses to provide an Ini configuration that will be merged into the users configuration. The users configuration will override anything set here.

        NOTE: Framework developers should use with caution. It is possible a user could provide configuration that would conflict with the frameworks configuration. For example: if this method returns an Ini object with the following configuration:

        
             [main]
             realm = com.myco.FoobarRealm
             realm.foobarSpecificField = A string
         
        And the user provides a similar configuration:
        
             [main]
             realm = net.differentco.MyCustomRealm
         
        This would merge into:
        
             [main]
             realm = net.differentco.MyCustomRealm
             realm.foobarSpecificField = A string
         
        This may cause a configuration error if MyCustomRealm does not contain the field foobarSpecificField. This can be avoided if the Framework Ini uses more unique names, such as foobarRealm. which would result in a merged configuration that looks like:
        
             [main]
             foobarRealm = com.myco.FoobarRealm
             foobarRealm.foobarSpecificField = A string
             realm = net.differentco.MyCustomRealm
         

        Returns:
        Ini configuration used by the framework integrations.
        Since:
        1.4
      • createIni

        protected Ini createIni​(String configLocation,
                                boolean required)
                         throws ConfigurationException
        Creates an Ini instance reflecting the specified path, or null if the path does not exist and is not required.

        If the path is required and does not exist or is empty, a ConfigurationException will be thrown.

        Parameters:
        configLocation - the resource path to load into an Ini instance.
        required - if the path must exist and be converted to a non-empty Ini instance.
        Returns:
        an Ini instance reflecting the specified path, or null if the path does not exist and is not required.
        Throws:
        ConfigurationException - if the path is required but results in a null or empty Ini instance.
      • getDefaultConfigLocations

        protected String[] getDefaultConfigLocations()
        Returns an array with two elements, /WEB-INF/shiro.ini and classpath:shiro.ini.
        Returns:
        an array with two elements, /WEB-INF/shiro.ini and classpath:shiro.ini.
      • getIni

        public Ini getIni()
        Returns the Ini instance reflecting this WebEnvironment's configuration.
        Returns:
        the Ini instance reflecting this WebEnvironment's configuration.
      • setIni

        public void setIni​(Ini ini)
        Allows for configuration via a direct Ini instance instead of via config locations.

        If the specified instance is null or empty, the fallback/default resource-based configuration will be used.

        Parameters:
        ini - the ini instance to use for creation.
      • setSecurityManagerFactory

        protected void setSecurityManagerFactory​(WebIniSecurityManagerFactory factory)
        Allows for setting the SecurityManager factory which will be used to create the SecurityManager.
        Parameters:
        factory - the SecurityManager factory to used.
        Since:
        1.4