Class HostFilter
- java.lang.Object
-
- All Implemented Interfaces:
javax.servlet.Filter,org.apache.shiro.util.Nameable,PathConfigProcessor
public class HostFilter extends AuthorizationFilter
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
Fields Modifier and Type Field Description static PatternIPV4_PATTERNstatic StringIPV4_QUAD_REGEXstatic StringIPV4_REGEXstatic StringPRIVATE_CLASS_A_REGEXstatic StringPRIVATE_CLASS_B_REGEXstatic StringPRIVATE_CLASS_B_SUBSETstatic StringPRIVATE_CLASS_C_REGEX-
Fields inherited from class org.apache.shiro.web.filter.AccessControlFilter
DEFAULT_LOGIN_URL, GET_METHOD, POST_METHOD
-
Fields inherited from class org.apache.shiro.web.filter.PathMatchingFilter
appliedPaths, pathMatcher
-
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
Constructors Constructor Description HostFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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, setUnauthorizedUrl
-
Methods inherited from class org.apache.shiro.web.filter.AccessControlFilter
getLoginUrl, getSubject, isLoginRequest, onAccessDenied, onPreHandle, redirectToLogin, saveRequest, saveRequestAndRedirectToLogin, setLoginUrl
-
Methods inherited from class org.apache.shiro.web.filter.PathMatchingFilter
getPathWithinApplication, isEnabled, pathsMatch, pathsMatch, preHandle, processPathConfig
-
Methods inherited from class org.apache.shiro.web.servlet.AdviceFilter
afterCompletion, cleanup, doFilterInternal, executeChain, postHandle
-
Methods inherited from class org.apache.shiro.web.servlet.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, isEnabled, isEnabled, isFilterOncePerRequest, setEnabled, setFilterOncePerRequest, 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, onFilterConfigSet, setFilterConfig
-
Methods inherited from class org.apache.shiro.web.servlet.ServletContextSupport
getContextAttribute, getContextInitParam, getServletContext, removeContextAttribute, setContextAttribute, setServletContext, toString
-
-
-
-
Field Detail
-
IPV4_QUAD_REGEX
public static final String IPV4_QUAD_REGEX
- See Also:
- Constant Field Values
-
IPV4_REGEX
public static final String IPV4_REGEX
- See Also:
- Constant Field Values
-
IPV4_PATTERN
public static final Pattern IPV4_PATTERN
-
PRIVATE_CLASS_B_SUBSET
public static final String PRIVATE_CLASS_B_SUBSET
- See Also:
- Constant Field Values
-
PRIVATE_CLASS_A_REGEX
public static final String PRIVATE_CLASS_A_REGEX
- See Also:
- Constant Field Values
-
PRIVATE_CLASS_B_REGEX
public static final String PRIVATE_CLASS_B_REGEX
- See Also:
- Constant Field Values
-
PRIVATE_CLASS_C_REGEX
public static final String PRIVATE_CLASS_C_REGEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
setAuthorizedHosts
public void setAuthorizedHosts(String authorizedHosts)
-
setDeniedHosts
public void setDeniedHosts(String deniedHosts)
-
isIpv4Candidate
protected boolean isIpv4Candidate(String host)
-
isAccessAllowed
protected boolean isAccessAllowed(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, Object mappedValue) throws ExceptionDescription 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.
-
-