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 *     bstefanescu
016 */
017
018package org.nuxeo.ecm.platform.ui.web.auth.interfaces;
019
020import javax.servlet.http.HttpServletRequest;
021import javax.servlet.http.HttpServletResponse;
022
023/**
024 * Interface for services that knows how to handle login responses. This was specially introduced to extend
025 * {@link NuxeoAuthenticationPlugin} interface to add login response handling capabilities to existing authenticators.
026 * <p>
027 * This interface should be implemented by {@link NuxeoAuthenticationPlugin} instances that needs full control over the
028 * login response.
029 *
030 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
031 */
032public interface LoginResponseHandler {
033
034    /**
035     * Handles the login error response.
036     *
037     * @param request the HTTP request
038     * @param response the HTTP response
039     * @return true if error was handled, false otherwise
040     */
041    boolean onError(HttpServletRequest request, HttpServletResponse response);
042
043    /**
044     * Handles login success response.
045     *
046     * @param request the HTTP request
047     * @param response the HTTP response
048     * @return true if response was handled, false otherwise
049     */
050    boolean onSuccess(HttpServletRequest request, HttpServletResponse response);
051
052}