Class HostFilter
java.lang.Object
- All Implemented Interfaces:
javax.servlet.Filter,org.apache.shiro.lang.util.Nameable,PathConfigProcessor
A Filter that can allow or deny access based on the host that sent the request.
WARNING: NOT YET FULLY IMPLEMENTED!!! Work in progress.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternIPV4 pattern.static final StringIPV4 quad regex.static final StringIPV4 regex.static final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.apache.shiro.web.filter.AccessControlFilter
DEFAULT_LOGIN_URL, GET_METHOD, POST_METHODFields inherited from class org.apache.shiro.web.filter.PathMatchingFilter
appliedPaths, pathMatcherFields inherited from class org.apache.shiro.web.servlet.OncePerRequestFilter
ALREADY_FILTERED_SUFFIXFields inherited from class org.apache.shiro.web.servlet.AbstractFilter
filterConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisAccessAllowed(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, Object mappedValue) Returnstrueif the request is allowed to proceed through the filter normally, orfalseif the request should be handled by theonAccessDenied(request,response,mappedValue)method instead.protected booleanisIpv4Candidate(String host) voidsetAuthorizedHosts(String authorizedHosts) voidsetDeniedHosts(String deniedHosts) Methods inherited from class org.apache.shiro.web.filter.authz.AuthorizationFilter
getUnauthorizedUrl, onAccessDenied, setUnauthorizedUrlMethods inherited from class org.apache.shiro.web.filter.AccessControlFilter
getLoginUrl, getSubject, isLoginRequest, onAccessDenied, onPreHandle, redirectToLogin, saveRequest, saveRequestAndRedirectToLogin, setLoginUrlMethods inherited from class org.apache.shiro.web.filter.PathMatchingFilter
getPathWithinApplication, isEnabled, pathsMatch, pathsMatch, preHandle, processPathConfigMethods inherited from class org.apache.shiro.web.servlet.AdviceFilter
afterCompletion, cleanup, doFilterInternal, executeChain, postHandleMethods inherited from class org.apache.shiro.web.servlet.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, isEnabled, isEnabled, isFilterOncePerRequest, setEnabled, setFilterOncePerRequest, shouldNotFilterMethods inherited from class org.apache.shiro.web.servlet.NameableFilter
getName, setName, toStringBuilderMethods inherited from class org.apache.shiro.web.servlet.AbstractFilter
destroy, getFilterConfig, getInitParam, init, onFilterConfigSet, setFilterConfigMethods inherited from class org.apache.shiro.web.servlet.ServletContextSupport
getContextAttribute, getContextInitParam, getServletContext, removeContextAttribute, setContextAttribute, setServletContext, toString
-
Field Details
-
IPV4_QUAD_REGEX
-
IPV4_REGEX
-
IPV4_PATTERN
IPV4 pattern. -
PRIVATE_CLASS_B_SUBSET
- See Also:
-
PRIVATE_CLASS_A_REGEX
- See Also:
-
PRIVATE_CLASS_B_REGEX
- See Also:
-
PRIVATE_CLASS_C_REGEX
- See Also:
-
-
Constructor Details
-
HostFilter
public HostFilter()
-
-
Method Details
-
setAuthorizedHosts
-
setDeniedHosts
-
isIpv4Candidate
-
isAccessAllowed
protected boolean isAccessAllowed(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, Object mappedValue) throws Exception Description copied from class:AccessControlFilterReturnstrueif the request is allowed to proceed through the filter normally, orfalseif the request should be handled by theonAccessDenied(request,response,mappedValue)method instead.- Specified by:
isAccessAllowedin classAccessControlFilter- Parameters:
request- the incomingServletRequestresponse- the outgoingServletResponsemappedValue- the filter-specific config value mapped to this filter in the URL rules mappings.- Returns:
trueif the request should proceed through the filter normally,falseif the request should be processed by this filter'sAccessControlFilter.onAccessDenied(ServletRequest, ServletResponse, Object)method instead.- Throws:
Exception- if an error occurs during processing.
-