public abstract class AuthenticatingFilter extends AuthenticationFilter
AuthenticationFilter that is capable of automatically performing an authentication attempt
based on the incoming request.| Modifier and Type | Field and Description |
|---|---|
static String |
PERMISSIVE |
DEFAULT_SUCCESS_URLDEFAULT_LOGIN_URL, GET_METHOD, POST_METHODappliedPaths, pathMatcherALREADY_FILTERED_SUFFIXfilterConfig| Constructor and Description |
|---|
AuthenticatingFilter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanup(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
Exception existing)
Overrides the default behavior to call
AccessControlFilter.onAccessDenied(javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.Object) and swallow the exception if the exception is
UnauthenticatedException. |
protected abstract org.apache.shiro.authc.AuthenticationToken |
createToken(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
protected org.apache.shiro.authc.AuthenticationToken |
createToken(String username,
String password,
boolean rememberMe,
String host) |
protected org.apache.shiro.authc.AuthenticationToken |
createToken(String username,
String password,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
protected boolean |
executeLogin(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
protected String |
getHost(javax.servlet.ServletRequest request)
Returns the host name or IP associated with the current subject.
|
protected boolean |
isAccessAllowed(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
Object mappedValue)
Determines whether the current subject should be allowed to make the current request.
|
protected boolean |
isPermissive(Object mappedValue)
Returns
true if the mappedValue contains the PERMISSIVE qualifier. |
protected boolean |
isRememberMe(javax.servlet.ServletRequest request)
Returns
true if "rememberMe" should be enabled for the login attempt associated with the
current request, false otherwise. |
protected boolean |
onLoginFailure(org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.authc.AuthenticationException e,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
protected boolean |
onLoginSuccess(org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.subject.Subject subject,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
getSuccessUrl, issueSuccessRedirect, setSuccessUrlgetLoginUrl, getSubject, isLoginRequest, onAccessDenied, onAccessDenied, onPreHandle, redirectToLogin, saveRequest, saveRequestAndRedirectToLogin, setLoginUrlgetPathWithinApplication, isEnabled, pathsMatch, pathsMatch, preHandle, processPathConfigafterCompletion, doFilterInternal, executeChain, postHandledoFilter, getAlreadyFilteredAttributeName, isEnabled, isEnabled, setEnabled, shouldNotFiltergetName, setName, toStringBuilderdestroy, getFilterConfig, getInitParam, init, onFilterConfigSet, setFilterConfiggetContextAttribute, getContextInitParam, getServletContext, removeContextAttribute, setContextAttribute, setServletContext, toStringpublic static final String PERMISSIVE
protected boolean executeLogin(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws Exception
Exceptionprotected abstract org.apache.shiro.authc.AuthenticationToken createToken(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws Exception
Exceptionprotected org.apache.shiro.authc.AuthenticationToken createToken(String username, String password, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
protected org.apache.shiro.authc.AuthenticationToken createToken(String username, String password, boolean rememberMe, String host)
protected boolean onLoginSuccess(org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.subject.Subject subject,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws Exception
Exceptionprotected boolean onLoginFailure(org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.authc.AuthenticationException e,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
protected String getHost(javax.servlet.ServletRequest request)
AuthenticationToken.
The default implementation merely returns ServletRequest.getRemoteHost().request - the incoming ServletRequestInetAddress to associate with the login attempt.protected boolean isRememberMe(javax.servlet.ServletRequest request)
true if "rememberMe" should be enabled for the login attempt associated with the
current request, false otherwise.
This implementation always returns false and is provided as a template hook to subclasses that
support rememberMe logins and wish to determine rememberMe in a custom mannner
based on the current request.request - the incoming ServletRequesttrue if "rememberMe" should be enabled for the login attempt associated with the
current request, false otherwise.protected boolean isAccessAllowed(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
Object mappedValue)
true if the user is authenticated. Will also return
true if the AccessControlFilter.isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) returns false and the "permissive" flag is set.isAccessAllowed in class AuthenticationFilterrequest - the incoming ServletRequestresponse - the outgoing ServletResponsemappedValue - the filter-specific config value mapped to this filter in the URL rules mappings.true if request should be allowed accessprotected boolean isPermissive(Object mappedValue)
true if the mappedValue contains the PERMISSIVE qualifier.true if this filter should be permissiveprotected void cleanup(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
Exception existing)
throws javax.servlet.ServletException,
IOException
AccessControlFilter.onAccessDenied(javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.Object) and swallow the exception if the exception is
UnauthenticatedException.cleanup in class AdviceFilterrequest - the incoming ServletRequestresponse - the outgoing ServletResponseexisting - any exception that might have occurred while executing the FilterChain or
pre or post advice, or null if the pre/chain/post execution did not throw an Exception.javax.servlet.ServletException - if any exception other than an IOException is thrown.IOException - if the pre/chain/post execution throw an IOExceptionCopyright © 2004–2017 The Apache Software Foundation. All rights reserved.