001/*
002 * (C) Copyright 2006-2008 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 * $Id$
018 */
019
020package org.nuxeo.ecm.platform.oauth.consumers;
021
022import java.util.List;
023
024/**
025 * Service interface for managing OAuth Service Consumers
026 *
027 * @author tiry
028 */
029public interface OAuthConsumerRegistry {
030
031    /**
032     * Get a Consumer from its consumerKey.
033     */
034    NuxeoOAuthConsumer getConsumer(String consumerKey);
035
036    /**
037     * Get a Consumer from its consumerKey.
038     * <p>
039     * The keyType param indicates if we need HMAC or RSA secret. This is needed because the default OAuthValidator
040     * implementation only uses 1 field for both Keys. If keyType is OAUth.RSA_SHA1, the consumerSecret field will be
041     * polupated with the RSA public key rather than the HMAC secret.
042     */
043    NuxeoOAuthConsumer getConsumer(String consumerKey, String keyType);
044
045    /**
046     * remove a Consumer
047     */
048    void deleteConsumer(String consumerKey);
049
050    /**
051     * List all registered Consumers
052     */
053    List<NuxeoOAuthConsumer> listConsumers();
054
055    /**
056     * Store a new Consumer
057     */
058    NuxeoOAuthConsumer storeConsumer(NuxeoOAuthConsumer consumer);
059}