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.service;
018
019import java.util.Collection;
020
021import org.mitre.openid.connect.model.WhitelistedSite;
022
023/**
024 * Interface for WhitelistedSite service
025 * 
026 * @author Michael Joseph Walsh, aanganes
027 * 
028 */
029public interface WhitelistedSiteService {
030
031        /**
032         * Return a collection of all WhitelistedSite managed by this service
033         * 
034         * @return the WhitelistedSite collection, or null
035         */
036        public Collection<WhitelistedSite> getAll();
037
038        /**
039         * Returns the WhitelistedSite for the given id
040         * 
041         * @param id
042         *            id the id of the WhitelistedSite
043         * @return a valid WhitelistedSite if it exists, null otherwise
044         */
045        public WhitelistedSite getById(Long id);
046
047        /**
048         * Find a WhitelistedSite by its associated ClientDetails reference
049         * 
050         * @param client        the Relying Party
051         * @return                      the corresponding WhitelistedSite if one exists for the RP, or null
052         */
053        public WhitelistedSite getByClientId(String clientId);
054
055        /**
056         * Return a collection of the WhitelistedSites created by a given user
057         * 
058         * @param creator       the user id of an admin who may have made some WhitelistedSites
059         * @return                      the collection of corresponding WhitelistedSites, if any, or null
060         */
061        public Collection<WhitelistedSite> getByCreator(String creatorId);
062
063        /**
064         * Removes the given WhitelistedSite from the repository
065         * 
066         * @param address
067         *            the WhitelistedSite object to remove
068         */
069        public void remove(WhitelistedSite whitelistedSite);
070
071        /**
072         * Persists a new WhitelistedSite
073         * 
074         * @param whitelistedSite
075         *            the WhitelistedSite to be saved
076         * @return
077         */
078        public WhitelistedSite saveNew(WhitelistedSite whitelistedSite);
079
080        /**
081         * Updates an existing whitelisted site
082         */
083        public WhitelistedSite update(WhitelistedSite oldWhitelistedSite, WhitelistedSite whitelistedSite);
084
085}