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.Collections;
023import java.util.List;
024import java.util.Map;
025
026import net.jcip.annotations.Immutable;
027
028import com.nimbusds.oauth2.sdk.ParseException;
029import com.nimbusds.oauth2.sdk.http.HTTPRequest;
030
031
032/**
033 * Entity listing request.
034 *
035 * <p>Related specifications:
036 *
037 * <ul>
038 *     <li>OpenID Connect Federation 1.0, section 7.3.1.
039 * </ul>
040 */
041@Immutable
042public class EntityListingRequest extends FederationAPIRequest {
043        
044        
045        /**
046         * Creates a new entity listing request.
047         *
048         * @param endpoint The federation list endpoint. Must not be
049         *                 {@code null}.
050         */
051        public EntityListingRequest(final URI endpoint) {
052                super(endpoint);
053        }
054        
055        
056        @Override
057        public Map<String, List<String>> toParameters() {
058                return Collections.emptyMap();
059        }
060        
061        
062        /**
063         * Parses an entity listing request from the specified HTTP request.
064         *
065         * @param httpRequest The HTTP request. Must not be {@code null}.
066         *
067         * @return The entity listing request.
068         *
069         * @throws ParseException If parsing failed.
070         */
071        public static EntityListingRequest parse(final HTTPRequest httpRequest)
072                throws ParseException {
073                
074                httpRequest.ensureMethod(HTTPRequest.Method.GET);
075                return new EntityListingRequest(httpRequest.getURI());
076        }
077}