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