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.oauth.providers;
019
020import java.util.List;
021
022/**
023 * This service is used to manage OAuth Service Providers: ie REST Services that can be used by Nuxeo via OAuth.
024 * <p>
025 * Typically, this service is used by Shindig to determine what what shared secret should be used by gadgets to fetch
026 * their data.
027 *
028 * @author tiry
029 */
030public interface OAuthServiceProviderRegistry {
031
032    /**
033     * Select the best provider given.
034     *
035     * @param gadgetUri the gadget url (or AppId)
036     * @param serviceName the service name as defined in MakeRequest
037     */
038    NuxeoOAuthServiceProvider getProvider(String gadgetUri, String serviceName);
039
040    /**
041     * This method is here for compatibility reasons. Providers that are directly contributed to the OpenSocialService
042     * are forwarded to the new centralized service.
043     */
044    NuxeoOAuthServiceProvider addReadOnlyProvider(String gadgetUri, String serviceName, String consumerKey,
045            String consumerSecret, String publicKey);
046
047    /**
048     * Deletes a provider.
049     */
050    void deleteProvider(String gadgetUri, String serviceName);
051
052    /**
053     * Deletes a provider.
054     */
055    void deleteProvider(String providerId);
056
057    /**
058     * Return the list of all know providers (both readonly and editable ones).
059     */
060    List<NuxeoOAuthServiceProvider> listProviders();
061
062}