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