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