001/*
002 * (C) Copyright 2010 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.shibboleth.service;
019
020import java.util.Map;
021
022import javax.servlet.http.HttpServletRequest;
023
024public interface ShibbolethAuthenticationService {
025
026    /**
027     * Returns the computed login URL to Shibboleth , or {@code null} if no login URL is configured.
028     *
029     * @param redirect URL
030     * @return login URL
031     */
032    String getLoginURL(String redirectURL);
033
034    /**
035     * Returns the computed logout URL to Shibboleth, or {@code null} if no logout URL is configured.
036     *
037     * @param redirect URL
038     * @return logout URL
039     */
040    String getLogoutURL(String redirectURL);
041
042    /**
043     * Returns the computed login URL to Shibboleth , or {@code null} if no login URL is configured.
044     *
045     * @param HTTP request
046     * @return login URL
047     */
048    String getLoginURL(HttpServletRequest request);
049
050    /**
051     * Returns the computed logout URL to Shibboleth, or {@code null} if no logout URL is configured.
052     *
053     * @param HTTP request
054     * @return logout URL
055     */
056    String getLogoutURL(HttpServletRequest request);
057
058    /**
059     * Returns the user ID based on the source IdP. In the configuration is defined which HTTP header is used for each
060     * registered IdP.
061     *
062     * @param HTTP request
063     * @return user ID
064     */
065    String getUserID(HttpServletRequest httpRequest);
066
067    /**
068     * Returns a map of the user metadata based on the configuration. Keys are the field names and values coming from
069     * the HTTP headers.
070     *
071     * @param HTTP request
072     * @return metadata map
073     */
074    Map<String, Object> getUserMetadata(String idField, HttpServletRequest httpRequest);
075
076}