001/*
002 * oauth2-oidc-sdk
003 *
004 * Copyright 2012-2016, 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.oauth2.sdk.as;
019
020
021import java.net.URI;
022
023import net.jcip.annotations.Immutable;
024
025import com.nimbusds.oauth2.sdk.AbstractConfigurationRequest;
026import com.nimbusds.oauth2.sdk.WellKnownPathComposeStrategy;
027import com.nimbusds.oauth2.sdk.id.Issuer;
028
029
030/**
031 * OAuth 2.0 Authorisation Server (AS) configuration request.
032 *
033 * <p>Example HTTP request:
034 *
035 * <pre>
036 * GET /.well-known/oauth-authorization-server HTTP/1.1
037 * Host: example.com
038 * </pre>
039 *
040 * <p>Related specifications:
041 *
042 * <ul>
043 *     <li>OAuth 2.0 Authorization Server Metadata (RFC 8414)
044 * </ul>
045 */
046@Immutable
047public class AuthorizationServerConfigurationRequest extends AbstractConfigurationRequest {
048        
049        
050        /**
051         * The well-known path for OAuth 2.0 Authorisation Server metadata.
052         */
053        public static final String OAUTH_SERVER_WELL_KNOWN_PATH = "/.well-known/oauth-authorization-server";
054        
055        
056        /**
057         * Creates a new OAuth 2.0 Authorisation Server configuration request
058         * using the {@link WellKnownPathComposeStrategy#POSTFIX postfix
059         * well-known path composition strategy}.
060         *
061         * @param issuer The issuer. Must represent a valid URL.
062         */
063        public AuthorizationServerConfigurationRequest(final Issuer issuer) {
064                this(issuer, WellKnownPathComposeStrategy.POSTFIX);
065        }
066        
067        
068        /**
069         * Creates a new OAuth 2.0 Authorisation Server configuration request.
070         *
071         * @param issuer   The issuer. Must represent a valid URL.
072         * @param strategy The well-known path composition strategy. Must not
073         *                 be {@code null}.
074         */
075        public AuthorizationServerConfigurationRequest(final Issuer issuer, final WellKnownPathComposeStrategy strategy) {
076                super(URI.create(issuer.getValue()), OAUTH_SERVER_WELL_KNOWN_PATH, strategy);
077        }
078}