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