public class IniWebEnvironment extends ResourceBasedWebEnvironment implements org.apache.shiro.util.Initializable, org.apache.shiro.util.Destroyable
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_WEB_INI_RESOURCE_PATH |
static String |
FILTER_CHAIN_RESOLVER_NAME |
static String |
SHIRO_FILTER_CONFIG_NAME |
| Constructor and Description |
|---|
IniWebEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure() |
protected FilterChainResolver |
createFilterChainResolver() |
protected ShiroFilterConfiguration |
createFilterConfiguration() |
protected org.apache.shiro.config.Ini |
createIni(String configLocation,
boolean required)
Creates an
Ini instance reflecting the specified path, or null if the path does not exist and
is not required. |
protected WebSecurityManager |
createWebSecurityManager() |
protected String[] |
getDefaultConfigLocations()
Returns an array with two elements,
/WEB-INF/shiro.ini and classpath:shiro.ini. |
protected org.apache.shiro.config.Ini |
getDefaultIni() |
protected Map<String,Object> |
getDefaults() |
protected org.apache.shiro.config.Ini |
getFrameworkIni()
Extension point to allow subclasses to provide an
Ini configuration that will be merged into the
users configuration. |
org.apache.shiro.config.Ini |
getIni()
Returns the
Ini instance reflecting this WebEnvironment's configuration. |
protected WebIniSecurityManagerFactory |
getSecurityManagerFactory()
Returns the SecurityManager factory used by this WebEnvironment.
|
protected org.apache.shiro.config.Ini |
getSpecifiedIni(String[] configLocations) |
void |
init()
Initializes this instance by resolving any potential (explicit or resource-configured)
Ini
configuration and calling configure for actual instance configuration. |
protected org.apache.shiro.config.Ini |
mergeIni(org.apache.shiro.config.Ini ini1,
org.apache.shiro.config.Ini ini2) |
protected org.apache.shiro.config.Ini |
parseConfig()
Loads configuration
Ini from ResourceBasedWebEnvironment.getConfigLocations() if set, otherwise falling back
to the getDefaultConfigLocations(). |
void |
setIni(org.apache.shiro.config.Ini ini)
Allows for configuration via a direct
Ini instance instead of via
config locations. |
protected void |
setSecurityManagerFactory(WebIniSecurityManagerFactory factory)
Allows for setting the SecurityManager factory which will be used to create the SecurityManager.
|
getConfigLocations, setConfigLocations, setConfigLocationsgetFilterChainResolver, getSecurityManager, getServletContext, getShiroFilterConfiguration, getWebSecurityManager, setFilterChainResolver, setSecurityManager, setServletContext, setShiroFilterConfiguration, setWebSecurityManagerdestroy, getObject, getObjects, getSecurityManagerName, lookupSecurityManager, setObject, setSecurityManagerNamepublic static final String DEFAULT_WEB_INI_RESOURCE_PATH
public static final String FILTER_CHAIN_RESOLVER_NAME
public static final String SHIRO_FILTER_CONFIG_NAME
public void init()
Ini
configuration and calling configure for actual instance configuration.init in interface org.apache.shiro.util.Initializableprotected org.apache.shiro.config.Ini parseConfig()
Ini from ResourceBasedWebEnvironment.getConfigLocations() if set, otherwise falling back
to the getDefaultConfigLocations(). Finally any Ini objects will be merged with the value returned
from getFrameworkIni()protected void configure()
protected org.apache.shiro.config.Ini getFrameworkIni()
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
protected org.apache.shiro.config.Ini getSpecifiedIni(String[] configLocations) throws org.apache.shiro.config.ConfigurationException
org.apache.shiro.config.ConfigurationExceptionprotected org.apache.shiro.config.Ini mergeIni(org.apache.shiro.config.Ini ini1,
org.apache.shiro.config.Ini ini2)
protected org.apache.shiro.config.Ini getDefaultIni()
protected org.apache.shiro.config.Ini createIni(String configLocation, boolean required) throws org.apache.shiro.config.ConfigurationException
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.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.Ini instance reflecting the specified path, or null if the path does not exist and
is not required.org.apache.shiro.config.ConfigurationException - if the path is required but results in a null or empty Ini instance.protected ShiroFilterConfiguration createFilterConfiguration()
protected FilterChainResolver createFilterChainResolver()
protected WebSecurityManager createWebSecurityManager()
protected String[] getDefaultConfigLocations()
/WEB-INF/shiro.ini and classpath:shiro.ini./WEB-INF/shiro.ini and classpath:shiro.ini.public org.apache.shiro.config.Ini getIni()
Ini instance reflecting this WebEnvironment's configuration.Ini instance reflecting this WebEnvironment's configuration.public void setIni(org.apache.shiro.config.Ini ini)
Ini instance instead of via
config locations.
If the specified instance is null or empty, the fallback/default resource-based configuration will be used.ini - the ini instance to use for creation.protected WebIniSecurityManagerFactory getSecurityManagerFactory()
protected void setSecurityManagerFactory(WebIniSecurityManagerFactory factory)
factory - the SecurityManager factory to used.Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.