001/*
002 * (C) Copyright 2010-2019 Nuxeo (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    String getLoginURL(String redirectURL);
034
035    /**
036     * Returns the computed logout URL to Shibboleth, or {@code null} if no logout URL is configured.
037     */
038    String getLogoutURL(String redirectURL);
039
040    /**
041     * Returns the computed login URL to Shibboleth , or {@code null} if no login URL is configured.
042     */
043    String getLoginURL(HttpServletRequest request);
044
045    /**
046     * Returns the computed logout URL to Shibboleth, or {@code null} if no logout URL is configured.
047     */
048    String getLogoutURL(HttpServletRequest request);
049
050    /**
051     * Returns the user ID based on the source IdP. In the configuration is defined which HTTP header is used for each
052     * registered IdP.
053     */
054    String getUserID(HttpServletRequest httpRequest);
055
056    /**
057     * Returns a map of the user metadata based on the configuration. Keys are the field names and values coming from
058     * the HTTP headers.
059     */
060    Map<String, Object> getUserMetadata(String idField, HttpServletRequest httpRequest);
061
062    /**
063     * Returns a bi-map of the user metadata {response headers, values} based on the configuration.
064     *
065     * @since 8.3
066     */
067    BiMap<String, String> getUserMetadata();
068
069}