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