public class ShiroFilter extends AbstractShiroFilter
web.xml
configuration. It expects the presence of a
Shiro WebEnvironment
in the ServletContext
, also
configured via web.xml
.
WebEnvironment
instance to
be configured, it must be defined in web.xml
with the companion
EnvironmentLoaderListener
, which performs the necessary
environment setup. For example:
<listener>
<listener-class>EnvironmentLoaderListener
</listener-class>
</listener>
...
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<-- Filter all web requests. This filter mapping is typically declared
before all others to ensure any other filters are secured as well: -->
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Configuration options (configuration file paths, etc) are specified as part of the
EnvironmentLoaderListener
configuration. See the
EnvironmentLoader
JavaDoc for configuration options.EnvironmentLoader
,
EnvironmentLoaderListener
,
Apache Shiro Web DocumentationALREADY_FILTERED_SUFFIX
filterConfig
Constructor and Description |
---|
ShiroFilter() |
Modifier and Type | Method and Description |
---|---|
void |
init()
Configures this instance based on the existing
WebEnvironment instance
available to the currently accessible servletContext . |
createDefaultSecurityManager, createSubject, doFilterInternal, executeChain, getExecutionChain, getFilterChainResolver, getSecurityManager, isHttpSessions, isStaticSecurityManagerEnabled, onFilterConfigSet, prepareServletRequest, prepareServletResponse, setFilterChainResolver, setSecurityManager, setStaticSecurityManagerEnabled, updateSessionLastAccessTime, wrapServletRequest, wrapServletResponse
doFilter, getAlreadyFilteredAttributeName, isEnabled, isEnabled, setEnabled, shouldNotFilter
getName, setName, toStringBuilder
destroy, getFilterConfig, getInitParam, init, setFilterConfig
getContextAttribute, getContextInitParam, getServletContext, removeContextAttribute, setContextAttribute, setServletContext, toString
public void init() throws Exception
WebEnvironment
instance
available to the currently accessible servletContext
.init
in class AbstractShiroFilter
Exception
EnvironmentLoaderListener
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.