|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.web.filter.GenericFilterBean
org.springframework.security.web.access.ExceptionTranslationFilter
public class ExceptionTranslationFilter
Handles any AccessDeniedException
and AuthenticationException
thrown within the
filter chain.
This filter is necessary because it provides the bridge between Java exceptions and HTTP responses. It is solely concerned with maintaining the user interface. This filter does not do any actual security enforcement.
If an AuthenticationException
is detected, the filter will launch the authenticationEntryPoint
.
This allows common handling of authentication failures originating from any subclass of
AbstractSecurityInterceptor
.
If an AccessDeniedException
is detected, the filter will determine whether or not the user is an anonymous
user. If they are an anonymous user, the authenticationEntryPoint
will be launched. If they are not
an anonymous user, the filter will delegate to the AccessDeniedHandler
.
By default the filter will use AccessDeniedHandlerImpl
.
To use this filter, it is necessary to specify the following properties:
authenticationEntryPoint
indicates the handler that
should commence the authentication process if an
AuthenticationException
is detected. Note that this may also
switch the current protocol from http to https for an SSL login.HttpSessionRequestCache
.
Field Summary |
---|
Fields inherited from class org.springframework.web.filter.GenericFilterBean |
---|
logger |
Constructor Summary | |
---|---|
ExceptionTranslationFilter()
Deprecated. Use constructor injection |
|
ExceptionTranslationFilter(AuthenticationEntryPoint authenticationEntryPoint)
|
|
ExceptionTranslationFilter(AuthenticationEntryPoint authenticationEntryPoint,
RequestCache requestCache)
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
|
AuthenticationEntryPoint |
getAuthenticationEntryPoint()
|
protected AuthenticationTrustResolver |
getAuthenticationTrustResolver()
|
protected void |
sendStartAuthentication(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain,
AuthenticationException reason)
|
void |
setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler)
|
void |
setAuthenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint)
Deprecated. Use constructor |
void |
setAuthenticationTrustResolver(AuthenticationTrustResolver authenticationTrustResolver)
|
void |
setRequestCache(RequestCache requestCache)
Deprecated. Use constructor |
void |
setThrowableAnalyzer(ThrowableAnalyzer throwableAnalyzer)
|
Methods inherited from class org.springframework.web.filter.GenericFilterBean |
---|
addRequiredProperty, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Deprecated public ExceptionTranslationFilter()
public ExceptionTranslationFilter(AuthenticationEntryPoint authenticationEntryPoint)
public ExceptionTranslationFilter(AuthenticationEntryPoint authenticationEntryPoint, RequestCache requestCache)
Method Detail |
---|
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class GenericFilterBean
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public AuthenticationEntryPoint getAuthenticationEntryPoint()
protected AuthenticationTrustResolver getAuthenticationTrustResolver()
protected void sendStartAuthentication(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain, AuthenticationException reason) throws javax.servlet.ServletException, IOException
javax.servlet.ServletException
IOException
public void setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler)
@Deprecated public void setAuthenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint)
public void setAuthenticationTrustResolver(AuthenticationTrustResolver authenticationTrustResolver)
public void setThrowableAnalyzer(ThrowableAnalyzer throwableAnalyzer)
@Deprecated public void setRequestCache(RequestCache requestCache)
HttpSessionRequestCache
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |