public class AuthenticationFilter
extends org.springframework.web.filter.OncePerRequestFilter
Filter
that performs authentication of a particular request. An outline of
the logic:
setRequestMatcher(RequestMatcher)
, then this filter does nothing and the
FilterChain
is continued. If it does match then...HttpServletRequest
into an Authentication
is made. If the result is empty, then the filter does nothing more and the
FilterChain
is continued. If it does create an Authentication
...AuthenticationManager
specified in
#GenericAuthenticationFilter(AuthenticationManager)
is used to perform
authentication.AuthenticationManagerResolver
specified in
#GenericAuthenticationFilter(AuthenticationManagerResolver)
is used to resolve
the appropriate authentication manager from context to perform authentication.AuthenticationSuccessHandler
is invoked
and the authentication is set on SecurityContextHolder
, else
AuthenticationFailureHandler
is invokedConstructor and Description |
---|
AuthenticationFilter(AuthenticationManager authenticationManager,
AuthenticationConverter authenticationConverter) |
AuthenticationFilter(AuthenticationManagerResolver<javax.servlet.http.HttpServletRequest> authenticationManagerResolver,
AuthenticationConverter authenticationConverter) |
Modifier and Type | Method and Description |
---|---|
protected void |
doFilterInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain filterChain) |
AuthenticationConverter |
getAuthenticationConverter() |
AuthenticationManagerResolver<javax.servlet.http.HttpServletRequest> |
getAuthenticationManagerResolver() |
AuthenticationFailureHandler |
getFailureHandler() |
RequestMatcher |
getRequestMatcher() |
AuthenticationSuccessHandler |
getSuccessHandler() |
void |
setAuthenticationConverter(AuthenticationConverter authenticationConverter) |
void |
setAuthenticationManagerResolver(AuthenticationManagerResolver<javax.servlet.http.HttpServletRequest> authenticationManagerResolver) |
void |
setFailureHandler(AuthenticationFailureHandler failureHandler) |
void |
setRequestMatcher(RequestMatcher requestMatcher) |
void |
setSuccessHandler(AuthenticationSuccessHandler successHandler) |
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch
public AuthenticationFilter(AuthenticationManager authenticationManager, AuthenticationConverter authenticationConverter)
public AuthenticationFilter(AuthenticationManagerResolver<javax.servlet.http.HttpServletRequest> authenticationManagerResolver, AuthenticationConverter authenticationConverter)
public RequestMatcher getRequestMatcher()
public void setRequestMatcher(RequestMatcher requestMatcher)
public AuthenticationConverter getAuthenticationConverter()
public void setAuthenticationConverter(AuthenticationConverter authenticationConverter)
public AuthenticationSuccessHandler getSuccessHandler()
public void setSuccessHandler(AuthenticationSuccessHandler successHandler)
public AuthenticationFailureHandler getFailureHandler()
public void setFailureHandler(AuthenticationFailureHandler failureHandler)
public AuthenticationManagerResolver<javax.servlet.http.HttpServletRequest> getAuthenticationManagerResolver()
public void setAuthenticationManagerResolver(AuthenticationManagerResolver<javax.servlet.http.HttpServletRequest> authenticationManagerResolver)
protected void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain) throws javax.servlet.ServletException, java.io.IOException
doFilterInternal
in class org.springframework.web.filter.OncePerRequestFilter
javax.servlet.ServletException
java.io.IOException