info.magnolia.cms.security
Class SecurityCallbackFilter

java.lang.Object
  extended by info.magnolia.cms.filters.AbstractMgnlFilter
      extended by info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter
          extended by info.magnolia.cms.security.SecurityCallbackFilter
All Implemented Interfaces:
MgnlFilter, javax.servlet.Filter

public class SecurityCallbackFilter
extends OncePerRequestAbstractMgnlFilter

A filter which handles 401, 403 HTTP response codes, as well as AccessDeniedExceptions, and renders an appropriate "login form" (which can consist of a redirect or anything else just as well). A number of HttpClientCallbacks can be configured for this filter, each with a different configuration, and behavior. The AbstractHttpClientCallback provides a number of filtering capabilities (using url, host or voters). This functionality used to live in BaseSecurityFilter, URISecurityFilter, as well as ContentSecurityFilter. These filters now merely set an HTTP response code or throw an exception, which is handled here.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Nested Class Summary
static class SecurityCallbackFilter.StatusSniffingResponseWrapper
          A simple HttpServletResponseWrapper which keeps track of the current http status code.
 
Constructor Summary
SecurityCallbackFilter()
           
 
Method Summary
 void addClientCallback(HttpClientCallback clientCallback)
           
 void doFilter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse originalResponse, javax.servlet.FilterChain chain)
           
 List<HttpClientCallback> getClientCallbacks()
           
protected  boolean needsCallback(SecurityCallbackFilter.StatusSniffingResponseWrapper response)
           
protected  void selectAndHandleCallback(javax.servlet.http.HttpServletRequest request, SecurityCallbackFilter.StatusSniffingResponseWrapper response)
           
protected  HttpClientCallback selectClientCallback(javax.servlet.http.HttpServletRequest request)
           
 
Methods inherited from class info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter
bypasses, doFilter
 
Methods inherited from class info.magnolia.cms.filters.AbstractMgnlFilter
acceptsEncoding, acceptsGzipEncoding, addAndVerifyHeader, addBypass, addMapping, destroy, getBypasses, getDispatching, getMapping, getMappings, getName, headerContains, init, isEnabled, mapsTo, matches, matchesDispatching, setDispatching, setEnabled, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityCallbackFilter

public SecurityCallbackFilter()
Method Detail

doFilter

public void doFilter(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse originalResponse,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in class AbstractMgnlFilter
Throws:
IOException
javax.servlet.ServletException

needsCallback

protected boolean needsCallback(SecurityCallbackFilter.StatusSniffingResponseWrapper response)

selectAndHandleCallback

protected void selectAndHandleCallback(javax.servlet.http.HttpServletRequest request,
                                       SecurityCallbackFilter.StatusSniffingResponseWrapper response)

selectClientCallback

protected HttpClientCallback selectClientCallback(javax.servlet.http.HttpServletRequest request)

addClientCallback

public void addClientCallback(HttpClientCallback clientCallback)

getClientCallbacks

public List<HttpClientCallback> getClientCallbacks()


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.