Class FilterSecurityInterceptor
- java.lang.Object
-
- org.springframework.security.access.intercept.AbstractSecurityInterceptor
-
- org.springframework.security.web.access.intercept.FilterSecurityInterceptor
-
- All Implemented Interfaces:
javax.servlet.Filter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.MessageSourceAware
public class FilterSecurityInterceptor extends AbstractSecurityInterceptor implements javax.servlet.Filter
Performs security handling of HTTP resources via a filter implementation.The
SecurityMetadataSourcerequired by this security interceptor is of typeFilterInvocationSecurityMetadataSource.Refer to
AbstractSecurityInterceptorfor details on the workflow.
-
-
Field Summary
-
Fields inherited from class org.springframework.security.access.intercept.AbstractSecurityInterceptor
logger, messages
-
-
Constructor Summary
Constructors Constructor Description FilterSecurityInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Not used (we rely on IoC container lifecycle services instead)voiddoFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)Method that is actually called by the filter chain.java.lang.Class<?>getSecureObjectClass()Indicates the type of secure objects the subclass will be presenting to the abstract parent for processing.FilterInvocationSecurityMetadataSourcegetSecurityMetadataSource()voidinit(javax.servlet.FilterConfig arg0)Not used (we rely on IoC container lifecycle services instead)voidinvoke(FilterInvocation filterInvocation)booleanisObserveOncePerRequest()Indicates whether once-per-request handling will be observed.SecurityMetadataSourceobtainSecurityMetadataSource()voidsetObserveOncePerRequest(boolean observeOncePerRequest)voidsetSecurityMetadataSource(FilterInvocationSecurityMetadataSource newSource)-
Methods inherited from class org.springframework.security.access.intercept.AbstractSecurityInterceptor
afterInvocation, afterPropertiesSet, beforeInvocation, finallyInvocation, getAccessDecisionManager, getAfterInvocationManager, getAuthenticationManager, getRunAsManager, isAlwaysReauthenticate, isRejectPublicInvocations, isValidateConfigAttributes, setAccessDecisionManager, setAfterInvocationManager, setAlwaysReauthenticate, setApplicationEventPublisher, setAuthenticationManager, setMessageSource, setPublishAuthorizationSuccess, setRejectPublicInvocations, setRunAsManager, setValidateConfigAttributes
-
-
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig arg0)
Not used (we rely on IoC container lifecycle services instead)- Specified by:
initin interfacejavax.servlet.Filter- Parameters:
arg0- ignored
-
destroy
public void destroy()
Not used (we rely on IoC container lifecycle services instead)- Specified by:
destroyin interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletExceptionMethod that is actually called by the filter chain. Simply delegates to theinvoke(FilterInvocation)method.- Specified by:
doFilterin interfacejavax.servlet.Filter- Parameters:
request- the servlet requestresponse- the servlet responsechain- the filter chain- Throws:
java.io.IOException- if the filter chain failsjavax.servlet.ServletException- if the filter chain fails
-
getSecurityMetadataSource
public FilterInvocationSecurityMetadataSource getSecurityMetadataSource()
-
obtainSecurityMetadataSource
public SecurityMetadataSource obtainSecurityMetadataSource()
- Specified by:
obtainSecurityMetadataSourcein classAbstractSecurityInterceptor
-
setSecurityMetadataSource
public void setSecurityMetadataSource(FilterInvocationSecurityMetadataSource newSource)
-
getSecureObjectClass
public java.lang.Class<?> getSecureObjectClass()
Description copied from class:AbstractSecurityInterceptorIndicates the type of secure objects the subclass will be presenting to the abstract parent for processing. This is used to ensure collaborators wired to theAbstractSecurityInterceptorall support the indicated secure object class.- Specified by:
getSecureObjectClassin classAbstractSecurityInterceptor- Returns:
- the type of secure object the subclass provides services for
-
invoke
public void invoke(FilterInvocation filterInvocation) throws java.io.IOException, javax.servlet.ServletException
- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
isObserveOncePerRequest
public boolean isObserveOncePerRequest()
Indicates whether once-per-request handling will be observed. By default this istrue, meaning theFilterSecurityInterceptorwill only execute once-per-request. Sometimes users may wish it to execute more than once per request, such as when JSP forwards are being used and filter security is desired on each included fragment of the HTTP request.- Returns:
true(the default) if once-per-request is honoured, otherwisefalseifFilterSecurityInterceptorwill enforce authorizations for each and every fragment of the HTTP request.
-
setObserveOncePerRequest
public void setObserveOncePerRequest(boolean observeOncePerRequest)
-
-