001/*
002 * (C) Copyright 2006-2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 */
017
018package org.nuxeo.ecm.platform.ui.web.auth.interfaces;
019
020import java.io.IOException;
021
022import javax.servlet.FilterChain;
023import javax.servlet.ServletException;
024import javax.servlet.ServletRequest;
025import javax.servlet.ServletResponse;
026
027/**
028 * The Authentication filter already provides a complex plugin model. Unfortunately in some cases, it's easier to have a
029 * dedicated filter to implement the custom auth logic. But in this case, you have to configure the new filter for each
030 * url pattern that is already protected by NuxeoAuthenticationFilter.
031 * <p>
032 * In order to avoid that you can run your Filter as a pre-Filter for the NuxeoAuthenticationFilter. For that you need
033 * to implement this interface and register your implementation via the preFilter extension point.
034 *
035 * @author tiry
036 */
037public interface NuxeoAuthPreFilter {
038
039    /**
040     * Main Filter method {@see Filter}. The FilterChain is only composed of the preFilters and the
041     * NuxeoAuthenticationFilter
042     *
043     * @see FilterChain
044     */
045    void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
046            ServletException;
047
048}