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; 027import com.nimbusds.oauth2.sdk.util.URLUtils; 028 029 030/** 031 * Federation API request. 032 * 033 * <p>Related specifications: 034 * 035 * <ul> 036 * <li>OpenID Connect Federation 1.0, section 7. 037 * </ul> 038 */ 039public abstract class FederationAPIRequest extends AbstractRequest { 040 041 042 /** 043 * Creates a new federation API request. 044 * 045 * @param endpoint The federation API endpoint. Must not be 046 * {@code null}. 047 */ 048 public FederationAPIRequest(final URI endpoint) { 049 super(endpoint); 050 } 051 052 053 /** 054 * Returns the request parameters. 055 * 056 * @return The request parameters. 057 */ 058 public abstract Map<String, List<String>> toParameters(); 059 060 061 @Override 062 public HTTPRequest toHTTPRequest() { 063 HTTPRequest httpRequest = new HTTPRequest(HTTPRequest.Method.GET, getEndpointURI()); 064 httpRequest.setQuery(URLUtils.serializeParameters(toParameters())); 065 return httpRequest; 066 } 067}