001/*
002 * oauth2-oidc-sdk
003 *
004 * Copyright 2012-2020, Connect2id Ltd and contributors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use
007 * this file except in compliance with the License. You may obtain a copy of the
008 * 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 distributed
013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
015 * specific language governing permissions and limitations under the License.
016 */
017
018package com.nimbusds.openid.connect.sdk.federation.api;
019
020
021import java.net.URI;
022import java.util.List;
023import java.util.Map;
024
025import com.nimbusds.oauth2.sdk.AbstractRequest;
026import com.nimbusds.oauth2.sdk.http.HTTPRequest;
027
028
029/**
030 * Federation API request.
031 *
032 * <p>Related specifications:
033 *
034 * <ul>
035 *     <li>OpenID Connect Federation 1.0, section 7.
036 * </ul>
037 */
038public abstract class FederationAPIRequest extends AbstractRequest {
039
040
041        /**
042         * Creates a new federation API request.
043         *
044         * @param endpoint The federation API endpoint. Must not be
045         *                 {@code null}.
046         */
047        public FederationAPIRequest(final URI endpoint) {
048                super(endpoint);
049        }
050
051
052        /**
053         * Returns the request parameters.
054         *
055         * @return The request parameters.
056         */
057        public abstract Map<String, List<String>> toParameters();
058
059
060        @Override
061        public HTTPRequest toHTTPRequest() {
062                HTTPRequest httpRequest = new HTTPRequest(HTTPRequest.Method.GET, getEndpointURI());
063                httpRequest.appendQueryParameters(toParameters());
064                return httpRequest;
065        }
066}