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.service;
019
020import java.io.IOException;
021
022import com.google.gson.stream.JsonReader;
023import com.google.gson.stream.JsonWriter;
024
025/**
026 * @author jricher
027 * @author arielak
028 */
029public interface MITREidDataService {
030
031        /**
032         * Data member for 1.X configurations
033         */
034        public static final String MITREID_CONNECT_1_0 = "mitreid-connect-1.0";
035        public static final String MITREID_CONNECT_1_1 = "mitreid-connect-1.1";
036        public static final String MITREID_CONNECT_1_2 = "mitreid-connect-1.2";
037        public static final String MITREID_CONNECT_1_3 = "mitreid-connect-1.3";
038
039        // member names
040        public static final String REFRESHTOKENS = "refreshTokens";
041        public static final String ACCESSTOKENS = "accessTokens";
042        public static final String WHITELISTEDSITES = "whitelistedSites";
043        public static final String BLACKLISTEDSITES = "blacklistedSites";
044        public static final String AUTHENTICATIONHOLDERS = "authenticationHolders";
045        public static final String GRANTS = "grants";
046        public static final String CLIENTS = "clients";
047        public static final String SYSTEMSCOPES = "systemScopes";
048
049        /**
050         * Write out the current server state to the given JSON writer as a JSON object
051         *
052         * @param writer
053         * @throws IOException
054         */
055        void exportData(JsonWriter writer) throws IOException;
056
057        /**
058         * Read in the current server state from the given JSON reader as a JSON object
059         *
060         * @param reader
061         */
062        void importData(JsonReader reader) throws IOException;
063
064        /**
065         * Return true if the this data service supports the given version. This is called before
066         * handing the service the reader through its importData function.
067         *
068         * @param version
069         * @return
070         */
071        boolean supportsVersion(String version);
072
073}