001/******************************************************************************* 002 * Copyright 2018 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.WhitelistedSite; 023 024/** 025 * WhitelistedSite repository interface 026 * 027 * @author Michael Joseph Walsh, aanganes 028 * 029 */ 030public interface WhitelistedSiteRepository { 031 032 /** 033 * Return a collection of all WhitelistedSite managed by this repository 034 * 035 * @return the WhitelistedSite collection, or null 036 */ 037 public Collection<WhitelistedSite> getAll(); 038 039 /** 040 * Returns the WhitelistedSite for the given id 041 * 042 * @param id 043 * id the id of the WhitelistedSite 044 * @return a valid WhitelistedSite if it exists, null otherwise 045 */ 046 public WhitelistedSite getById(Long id); 047 048 /** 049 * Find a WhitelistedSite by its associated ClientDetails reference 050 * 051 * @param client the Relying Party 052 * @return the corresponding WhitelistedSite if one exists for the RP, or null 053 */ 054 public WhitelistedSite getByClientId(String clientId); 055 056 /** 057 * Return a collection of the WhitelistedSites created by a given user 058 * 059 * @param creator the id of the admin who may have created some WhitelistedSites 060 * @return the collection of corresponding WhitelistedSites, if any, or null 061 */ 062 public Collection<WhitelistedSite> getByCreator(String creatorId); 063 064 /** 065 * Removes the given IdToken from the repository 066 * 067 * @param whitelistedSite 068 * the WhitelistedSite object to remove 069 */ 070 public void remove(WhitelistedSite whitelistedSite); 071 072 /** 073 * Persists a WhitelistedSite 074 * 075 * @param whitelistedSite 076 * @return 077 */ 078 public WhitelistedSite save(WhitelistedSite whiteListedSite); 079 080 /** 081 * Persist changes to a whitelistedSite. The ID of oldWhitelistedSite is retained. 082 * @param oldWhitelistedSite 083 * @param whitelistedSite 084 * @return 085 */ 086 public WhitelistedSite update(WhitelistedSite oldWhitelistedSite, WhitelistedSite whitelistedSite); 087 088}