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