Class AuthenticationFilter
java.lang.Object
org.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.AdviceFilter
org.apache.shiro.web.filter.PathMatchingFilter
org.apache.shiro.web.filter.AccessControlFilter
org.apache.shiro.web.filter.authc.AuthenticationFilter
org.apache.shiro.web.filter.authc.AuthenticatingFilter
org.apache.shiro.web.filter.authc.FormAuthenticationFilter
de.businesscode.bcdui.subjectsettings.AuthenticationFilter
- All Implemented Interfaces:
jakarta.servlet.Filter,org.apache.shiro.lang.util.Nameable,org.apache.shiro.web.filter.PathConfigProcessor
public class AuthenticationFilter
extends org.apache.shiro.web.filter.authc.FormAuthenticationFilter
extending Shiro's FormAuthenticationFilter to add
additional authentication scheme.
uses ExternalAuthenticationToken which shall be supported by any of registered realm,
the default JdbcRealm supports such token. To enable SPNEGO you have also to attach
de.businesscode.bcdui.security.SpnegoValve to your context, i.e in context.xml:
<Context className="de.businesscode.bcdui.security.SpnegoValve">the implementation is provided by bcd-spnego.jar library located in externallib folder of BCD-UI, that library has to be available to tomcat's common classloader, i.e. in TOMCAT_HOME/lib
Usage: override the default 'authc' filter by setting to this class in [main] section of Shiro configuration:
[main] authc = de.businesscode.bcdui.subjectsettings.AuthenticationFilter realm = de.businesscode.bcdui.subjectsettings.JdbcRealm ...
-
Field Summary
FieldsFields inherited from class org.apache.shiro.web.filter.authc.FormAuthenticationFilter
DEFAULT_ERROR_KEY_ATTRIBUTE_NAME, DEFAULT_PASSWORD_PARAM, DEFAULT_REMEMBER_ME_PARAM, DEFAULT_USERNAME_PARAMFields inherited from class org.apache.shiro.web.filter.authc.AuthenticatingFilter
PERMISSIVEFields inherited from class org.apache.shiro.web.filter.authc.AuthenticationFilter
DEFAULT_SUCCESS_URLFields 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 TypeMethodDescriptionvoiddoFilterInternal(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) handle explicit SPNEGO preauthenticationprotected voidissueSuccessRedirect(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) implement response flow upon successful authentication, instead of responding http 301 we return the "X-BCD.Location" header to be evaluated by the login script.protected voidredirectToLogin(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Here we redirect to login.html We save the originally requested URL here in the session as obviously it's the last chance in the login flow to do soMethods inherited from class org.apache.shiro.web.filter.authc.FormAuthenticationFilter
createToken, getFailureKeyAttribute, getPassword, getPasswordParam, getRememberMeParam, getUsername, getUsernameParam, isLoginSubmission, isRememberMe, onAccessDenied, onLoginFailure, onLoginSuccess, setFailureAttribute, setFailureKeyAttribute, setLoginUrl, setPasswordParam, setRememberMeParam, setUsernameParamMethods inherited from class org.apache.shiro.web.filter.authc.AuthenticatingFilter
cleanup, createToken, createToken, executeLogin, getHost, isAccessAllowed, isPermissiveMethods inherited from class org.apache.shiro.web.filter.authc.AuthenticationFilter
getSuccessUrl, setSuccessUrlMethods inherited from class org.apache.shiro.web.filter.AccessControlFilter
getLoginUrl, getSubject, isLoginRequest, onAccessDenied, onPreHandle, saveRequest, saveRequestAndRedirectToLoginMethods 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, 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
-
X_BCD_LOCATION_HEADER
- See Also:
-
-
Constructor Details
-
AuthenticationFilter
public AuthenticationFilter()
-
-
Method Details
-
doFilterInternal
public void doFilterInternal(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws jakarta.servlet.ServletException, IOException handle explicit SPNEGO preauthentication- Overrides:
doFilterInternalin classorg.apache.shiro.web.servlet.AdviceFilter- Throws:
jakarta.servlet.ServletExceptionIOException
-
issueSuccessRedirect
protected void issueSuccessRedirect(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws Exception implement response flow upon successful authentication, instead of responding http 301 we return the "X-BCD.Location" header to be evaluated by the login script.- Overrides:
issueSuccessRedirectin classorg.apache.shiro.web.filter.authc.AuthenticationFilter- Throws:
Exception
-
redirectToLogin
protected void redirectToLogin(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws IOException Here we redirect to login.html We save the originally requested URL here in the session as obviously it's the last chance in the login flow to do so- Overrides:
redirectToLoginin classorg.apache.shiro.web.filter.AccessControlFilter- Throws:
IOException
-