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.util.List;
021import java.util.Map;
022
023import javax.servlet.http.HttpServletRequest;
024import javax.servlet.http.HttpServletResponse;
025
026import org.nuxeo.ecm.platform.api.login.UserIdentificationInfo;
027
028public interface NuxeoAuthenticationPlugin {
029
030    /**
031     * Handles the Login Prompt.
032     *
033     * @param httpRequest the request
034     * @param httpResponse the response
035     * @return true if AuthFilter must stop execution (ie: login prompt generated a redirect), false otherwise
036     */
037    Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL);
038
039    /**
040     * Retrieves user identification information from the request.
041     *
042     * @param httpRequest the request
043     * @param httpResponse the response
044     */
045    UserIdentificationInfo handleRetrieveIdentity(HttpServletRequest httpRequest, HttpServletResponse httpResponse);
046
047    /**
048     * Defines if the authentication plugin needs to do a login prompt.
049     *
050     * @return true if LoginPrompt is used
051     */
052    Boolean needLoginPrompt(HttpServletRequest httpRequest);
053
054    /**
055     * Initializes the Plugin from parameters set in the XML descriptor.
056     */
057    void initPlugin(Map<String, String> parameters);
058
059    /**
060     * Returns the list of prefix for unauthenticated URLs, typically the URLs associated to login prompt.
061     */
062    List<String> getUnAuthenticatedURLPrefix();
063
064}