|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.shiro.web.servlet.ServletContextSupport
org.apache.shiro.web.servlet.AbstractFilter
org.apache.shiro.web.servlet.NameableFilter
org.apache.shiro.web.servlet.OncePerRequestFilter
org.apache.shiro.web.servlet.AbstractShiroFilter
org.apache.shiro.web.servlet.IniShiroFilter
ShiroFilter
@Deprecated public class IniShiroFilter
ShiroFilter
in web.xml
instead.
See the ShiroFilter
JavaDoc for usage.
======================
Servlet Filter that configures and enables all Shiro functions within a web application by using the
INI configuration format.
The actual INI configuration contents are not covered here, but instead in Shiro's
Configuration Documentation and additional web-specific
Web Documentation.
shiro.ini
resource to be located at
/WEB-INF/shiro.ini
, or, if not there, falls back to checking the root of the classpath
(i.e. classpath:shiro.ini
):
<filter> <filter-name>ShiroFilter</filter-name> <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class> </filter>
/WEB-INF/shiro.ini
or
classpath:shiro.ini
, you may specify an alternate location via the configPath init-param
:
<filter> <filter-name>ShiroFilter</filter-name> <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class> <init-param> <param-name>configPath</param-name> <param-value>/WEB-INF/someFile.ini</param-value> </init-param> </filter>Unqualified (schemeless or 'non-prefixed') paths are assumed to be
ServletContext
resource paths, resolvable
via ServletContext#getResourceAsStream
.
Non-ServletContext resources may be loaded from qualified locations by specifying prefixes indicating the source,
e.g. file:
, url:
, and classpath:
. See the
ResourceUtils.getInputStreamForPath(String)
JavaDoc for more.
config init-param
:
<filter> <filter-name>ShiroFilter</filter-name> <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class> <init-param> <param-name>config</param-name> <param-value> #INI config goes here... </param-value> </init-param> </filter>Although this is typically not recommended because any Shiro configuration changes would contribute to version control 'noise' in the web.xml file. When creating the shiro.ini configuration itself, please see Shiro's Configuration Documentation and Web Documentation.
Field Summary | |
---|---|
static String |
CONFIG_INIT_PARAM_NAME
Deprecated. |
static String |
CONFIG_PATH_INIT_PARAM_NAME
Deprecated. |
static String |
DEFAULT_WEB_INI_RESOURCE_PATH
Deprecated. |
Fields inherited from class org.apache.shiro.web.servlet.OncePerRequestFilter |
---|
ALREADY_FILTERED_SUFFIX |
Fields inherited from class org.apache.shiro.web.servlet.AbstractFilter |
---|
filterConfig |
Constructor Summary | |
---|---|
IniShiroFilter()
Deprecated. |
Method Summary | |
---|---|
protected void |
applyFilterChainResolver(Ini ini,
Map<String,?> defaults)
Deprecated. |
protected void |
applyInitParams()
Deprecated. |
protected Map<String,?> |
applySecurityManager(Ini ini)
Deprecated. |
protected void |
configure()
Deprecated. |
protected Ini |
convertConfigToIni(String config)
Deprecated. |
protected Ini |
convertPathToIni(String path)
Deprecated. Converts the specified file path to an Ini instance. |
String |
getConfig()
Deprecated. Returns the actual INI configuration text to use to build the SecurityManager and
FilterChainResolver used by the web application or null if the
configPath should be used to load a fallback INI source. |
String |
getConfigPath()
Deprecated. Returns the config path to be used to load a .ini file for configuration if a configuration is not specified via the config attribute. |
protected Ini |
getServletContextIniResource(String servletContextPath)
Deprecated. Returns the INI instance reflecting the specified servlet context resource path or null if no
resource was found. |
void |
init()
Deprecated. |
protected Ini |
loadIniFromConfig()
Deprecated. |
protected Ini |
loadIniFromPath()
Deprecated. |
void |
setConfig(String config)
Deprecated. Sets the actual INI configuration text to use to build the SecurityManager and
FilterChainResolver used by the web application. |
void |
setConfigPath(String configPath)
Deprecated. Sets the config path to be used to load a .ini file for configuration if a configuration is not specified via the config attribute. |
Methods inherited from class org.apache.shiro.web.servlet.OncePerRequestFilter |
---|
doFilter, getAlreadyFilteredAttributeName, isEnabled, isEnabled, setEnabled, shouldNotFilter |
Methods inherited from class org.apache.shiro.web.servlet.NameableFilter |
---|
getName, setName, toStringBuilder |
Methods inherited from class org.apache.shiro.web.servlet.AbstractFilter |
---|
destroy, getFilterConfig, getInitParam, init, setFilterConfig |
Methods inherited from class org.apache.shiro.web.servlet.ServletContextSupport |
---|
getContextAttribute, getContextInitParam, getServletContext, removeContextAttribute, setContextAttribute, setServletContext, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CONFIG_INIT_PARAM_NAME
public static final String CONFIG_PATH_INIT_PARAM_NAME
public static final String DEFAULT_WEB_INI_RESOURCE_PATH
Constructor Detail |
---|
public IniShiroFilter()
Method Detail |
---|
public String getConfig()
SecurityManager
and
FilterChainResolver
used by the web application or null
if the
configPath
should be used to load a fallback INI source.
This value is null
by default, but it will be automatically set to the value of the
'config
' init-param
if it exists in the FilterConfig
provided by the servlet
container at startup.
SecurityManager
and
FilterChainResolver
used by the web application or null
if the
configPath
should be used to load a fallback INI source.public void setConfig(String config)
SecurityManager
and
FilterChainResolver
used by the web application. If this value is null
, the
configPath
will be checked to see if a .ini file should be loaded instead.
This value is null
by default, but it will be automatically set to the value of the
'config
' init-param
if it exists in the FilterConfig
provided by the servlet
container at startup.
config
- the actual INI configuration text to use to build the SecurityManager
and
FilterChainResolver
used by the web application.public String getConfigPath()
config
attribute.
This value is null
by default, but it will be automatically set to the value of the
'configPath
' init-param
if it exists in the FilterConfig
provided by the servlet
container at startup.
config
attribute.public void setConfigPath(String configPath)
config
attribute.
This value is null
by default, but it will be automatically set to the value of the
'configPath
' init-param
if it exists in the FilterConfig
provided by the servlet
container at startup.
configPath
- the config path to be used to load a .ini file for configuration if a configuration is
not specified via the config
attribute.public void init() throws Exception
init
in class AbstractShiroFilter
Exception
protected void applyInitParams() throws Exception
Exception
protected void configure() throws Exception
Exception
protected Ini loadIniFromConfig()
protected Ini loadIniFromPath()
protected Map<String,?> applySecurityManager(Ini ini)
protected void applyFilterChainResolver(Ini ini, Map<String,?> defaults)
protected Ini convertConfigToIni(String config)
protected Ini getServletContextIniResource(String servletContextPath)
null
if no
resource was found.
servletContextPath
- the servlet context resource path of the INI file to load
null
if no
resource was found.protected Ini convertPathToIni(String path)
Ini
instance.
If the path does not have a resource prefix as defined by ResourceUtils.hasResourcePrefix(String)
, the
path is expected to be resolvable by the ServletContext
via
ServletContext.getResourceAsStream(String)
.
path
- the path of the INI resource to load into an INI instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |