001/*
002 * (C) Copyright 2006-2008 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 */
019
020package org.nuxeo.ecm.platform.ui.web.auth.interfaces;
021
022import java.io.IOException;
023
024import javax.servlet.FilterChain;
025import javax.servlet.ServletException;
026import javax.servlet.ServletRequest;
027import javax.servlet.ServletResponse;
028
029/**
030 * The Authentication filter already provides a complex plugin model. Unfortunately in some cases, it's easier to have a
031 * dedicated filter to implement the custom auth logic. But in this case, you have to configure the new filter for each
032 * url pattern that is already protected by NuxeoAuthenticationFilter.
033 * <p>
034 * In order to avoid that you can run your Filter as a pre-Filter for the NuxeoAuthenticationFilter. For that you need
035 * to implement this interface and register your implementation via the preFilter extension point.
036 *
037 * @author tiry
038 */
039public interface NuxeoAuthPreFilter {
040
041    /**
042     * Main Filter method {@see Filter}. The FilterChain is only composed of the preFilters and the
043     * NuxeoAuthenticationFilter
044     *
045     * @see FilterChain
046     */
047    void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
048            ServletException;
049
050}