001/*******************************************************************************
002 * Copyright 2014 The MITRE Corporation
003 *   and the MIT Kerberos and Internet Trust Consortium
004 * 
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 * 
009 *   http://www.apache.org/licenses/LICENSE-2.0
010 * 
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 ******************************************************************************/
017package org.mitre.openid.connect.repository;
018
019import java.util.Collection;
020
021import org.mitre.openid.connect.model.ApprovedSite;
022
023/**
024 * ApprovedSite repository interface
025 *
026 * @author Michael Joseph Walsh, aanganes
027 *
028 */
029public interface ApprovedSiteRepository {
030
031        /**
032         * Returns the ApprovedSite for the given id
033         * 
034         * @param id
035         *            id the id of the ApprovedSite
036         * @return a valid ApprovedSite if it exists, null otherwise
037         */
038        public ApprovedSite getById(Long id);
039
040        /**
041         * Return a collection of all ApprovedSites managed by this repository
042         * 
043         * @return the ApprovedSite collection, or null
044         */
045        public Collection<ApprovedSite> getAll();
046
047        /**
048         * Return a collection of ApprovedSite managed by this repository matching the
049         * provided client ID and user ID
050         * 
051         * @param clientId
052         * @param userId
053         * @return
054         */
055        public Collection<ApprovedSite> getByClientIdAndUserId(String clientId, String userId);
056
057        /**
058         * Removes the given ApprovedSite from the repository
059         * 
060         * @param aggregator
061         *            the ApprovedSite object to remove
062         */
063        public void remove(ApprovedSite approvedSite);
064
065        /**
066         * Persists an ApprovedSite
067         * 
068         * @param aggregator
069         *            valid ApprovedSite instance
070         * @return the persisted entity
071         */
072        public ApprovedSite save(ApprovedSite approvedSite);
073
074        /**
075         * Get all sites approved by this user
076         * @param userId
077         * @return
078         */
079        public Collection<ApprovedSite> getByUserId(String userId);
080
081        /**
082         * Get all sites associated with this client
083         * @param clientId
084         * @return
085         */
086        public Collection<ApprovedSite> getByClientId(String clientId);
087
088}