private static IAuthorizationState GetAccessToken(string refresh)
        {
            var authorizationServer = new AuthorizationServerDescription
            {
                //AuthorizationEndpoint = new Uri(AUTHORIZATION_ENDPOINT),
                TokenEndpoint   = new Uri(TOKEN_ENDPOINT),
                ProtocolVersion = ProtocolVersion.V20,
            };

            // get a reference to the auth server
            var client = new UserAgentClient(authorizationServer, CLIENT_ID, CLIENT_SECRET);

            // now get a token
            IAuthorizationState ostate;

            if (refresh == null)
            {
                ostate = client.ExchangeUserCredentialForToken(TEST_USERNAME, TEST_PASSWORD, new[] { API_ENDPOINT });
            }
            else
            {
                // we had previously authenticated so we can use the token rather than the credentials to get a new access token
                ostate = new AuthorizationState(new[] { API_ENDPOINT });
                ostate.RefreshToken = refresh;
                client.RefreshAuthorization(ostate);
            }

            // return result
            return(ostate);
        }
Exemple #2
0
        //Authentication Method
        public void Authenticate()
        {
            var serverDescription = new AuthorizationServerDescription();

            serverDescription.AuthorizationEndpoint = new Uri(AuthorizationEndpointUrl);
            serverDescription.TokenEndpoint         = new Uri(TokenEndpointUrl);
            serverDescription.ProtocolVersion       = ProtocolVersion.V20;

            var client = new WebServerClient(serverDescription);

            client.ClientIdentifier           = ClientIdentifier;
            client.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(ClientSecret);

            var token = client.GetClientAccessToken();

            //var request = (HttpWebRequest)WebRequest.Create("http://localhost:8080/test/");
            ////System.Diagnostics.Process.Start("http://localhost:8080/test/");

            //request.Method = "GET";
            //client.AuthorizeRequest(request, token);
            //var response = request.GetResponse();

            //var postreqreader = new StreamReader(response.GetResponseStream());
            //var json = postreqreader.ReadToEnd();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserAgentClient"/> class.
 /// </summary>
 /// <param name="authorizationServer">The token issuer.</param>
 /// <param name="clientIdentifier">The client identifier.</param>
 /// <param name="clientSecret">The client secret.</param>
 public NativeApplicationClient(
     AuthorizationServerDescription authorizationServer,
     string clientIdentifier,
     string clientSecret)
     : base(authorizationServer, clientIdentifier, clientSecret)
 {
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EndUserAuthorizationRequestC"/> class.
 /// </summary>
 /// <param name="authorizationServer">The authorization server.</param>
 internal EndUserAuthorizationRequestC(AuthorizationServerDescription authorizationServer)
     : base(authorizationServer.AuthorizationEndpoint, authorizationServer.Version)
 {
     Requires.NotNull(authorizationServer, "authorizationServer");
     Requires.True(authorizationServer.Version != null, "authorizationServer");
     Requires.True(authorizationServer.AuthorizationEndpoint != null, "authorizationServer");
 }
        /// <summary>
        /// Create the web server client used for OAuth2 authentication.
        /// </summary>
        /// <returns>Exact Online web server client</returns>
        public static WebServerClient CreateClient()
        {
            AuthorizationServerDescription description = GetAuthServerDescription();
            WebServerClient client = new WebServerClient(description, ConfigurationManager.AppSettings["exactClientId"], ConfigurationManager.AppSettings["exactClientSecret"]);

            return(client);
        }
        public ExactOnlineConnection(string clientId, string clientSecret, string redirectUri, string endPoint, IDropboxUserToken dropboxUserToken)
        {
            this.dropboxUserToken = dropboxUserToken;

            miscellaneousDocumentType = 55;

            generalCategory = Guid.Parse("3b6d3833-b31b-423d-bc3c-39c62b8f2b12"); //Guid.Parse(clientId);

            this.endPoint = endPoint;

            authorization = new AuthorizationState
            {
                Callback = new Uri(redirectUri)
            };

            var token = dropboxUserToken.TryRetrieveTokenFromDatabase(HardcodedUser.Id);

            authorization.AccessToken = token.ExactAccessToken;

            authorization.AccessTokenExpirationUtc = token.ExactAccessTokenExpiration;

            exactClient = IsAccessTokenValid() ? new ExactOnlineClient(endPoint, GetAccessToken) : exactClient;

            var serverDescription = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri(string.Format("{0}/api/oauth2/auth", endPoint)),
                TokenEndpoint         = new Uri(string.Format("{0}/api/oauth2/token", endPoint))
            };

            oAuthClient = new UserAgentClient(serverDescription, clientId, clientSecret);
            oAuthClient.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(clientSecret);
        }
Exemple #7
0
        protected async void Button1_Click(object sender, EventArgs e)
        {
            var authServer = new AuthorizationServerDescription()
            {
                TokenEndpoint   = new Uri("http://localhost:53022/OAuth/token "),
                ProtocolVersion = ProtocolVersion.V20
            };
            WebServerClient Client = new WebServerClient(authServer, "idefav", "1");

            var code = await Client.GetClientAccessTokenAsync(new string[] { "http://localhost:55045/IService1/DoWork" });

            string token = code.AccessToken;

            Service1Reference.Service1Client service1Client = new Service1Client();
            var httpRequest = (HttpWebRequest)WebRequest.Create(service1Client.Endpoint.Address.Uri);

            ClientBase.AuthorizeRequest(httpRequest, token);
            var httpDetails = new HttpRequestMessageProperty();

            httpDetails.Headers[HttpRequestHeader.Authorization] = httpRequest.Headers[HttpRequestHeader.Authorization];

            using (var scope = new OperationContextScope(service1Client.InnerChannel))
            {
                if (OperationContext.Current.OutgoingMessageProperties.ContainsKey(HttpRequestMessageProperty.Name))
                {
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpDetails;
                }
                else
                {
                    OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpDetails);
                }

                Button1.Text = service1Client.DoWork();
            }
        }
Exemple #8
0
        // GET: ClientCredential
        public async Task <ActionResult> Index()
        {
            ViewBag.ApiResult   = "";
            ViewBag.AccessToken = "";

            if (Request.HttpMethod == "POST")
            {
                var authServer = new AuthorizationServerDescription
                {
                    AuthorizationEndpoint = new Uri(Paths.AuthorizationServerBaseAddress + Paths.AuthorizePath),
                    TokenEndpoint         = new Uri(Paths.AuthorizationServerBaseAddress + Paths.TokenPath)
                };
                var webServerClient = new WebServerClient(authServer, Clients.Client1.Id, Clients.Client1.Secret);

                var state = webServerClient.GetClientAccessToken(new[] { "test1", "test2", "test3" });
                var token = state.AccessToken;
                ViewBag.AccessToken = token;

                var client    = new HttpClient(webServerClient.CreateAuthorizingHandler(token));
                var apiResult = await client.GetStringAsync(Paths.ResourceUserApiPath);

                ViewBag.ApiResult = apiResult;
            }

            return(View());
        }
Exemple #9
0
        public async Task <ActionResult> Index(string username, string password)
        {
            ViewBag.Username    = username;
            ViewBag.Password    = password;
            ViewBag.ApiResult   = "";
            ViewBag.AccessToken = "";

            if (!string.IsNullOrEmpty(username))
            {
                var authServer = new AuthorizationServerDescription
                {
                    AuthorizationEndpoint = new Uri(Paths.AuthorizationServerBaseAddress + Paths.AuthorizePath),
                    TokenEndpoint         = new Uri(Paths.AuthorizationServerBaseAddress + Paths.TokenPath)
                };
                var webServerClient = new WebServerClient(authServer, Clients.Client1.Id, Clients.Client1.Secret);

                var state = webServerClient.ExchangeUserCredentialForToken(username, password, new[] { "test1", "test2", "test3" });
                var token = state.AccessToken;
                ViewBag.AccessToken = token;

                var client    = new HttpClient(webServerClient.CreateAuthorizingHandler(token));
                var apiResult = await client.GetStringAsync(Paths.ResourceUserApiPath);

                ViewBag.ApiResult = apiResult;
            }
            return(View());
        }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="Google.Apis.Authentication.OAuth2.DotNetOpenAuth.AssertionFlowMessage"/> class.
 /// </summary>
 /// <param name='authorizationServer'>
 /// Authorization server description.
 /// </param>
 public AssertionFlowMessage(AuthorizationServerDescription authorizationServer) :
     base(new Version(2, 0), MessageTransport.Direct, authorizationServer.TokenEndpoint)
 {
     GrantType        = "assertion";
     AssertionType    = GoogleAssertionType;
     this.HttpMethods = HttpDeliveryMethods.PostRequest;
 }
Exemple #11
0
 public virtual IAuthorizationState ProcessUserAuthorization(
     WebServerClient authClient, AuthorizationServerDescription authServer, IServiceBase authService)
 {
     return(HostContext.Config.StripApplicationVirtualPath
         ? authClient.ProcessUserAuthorization(authService.Request.ToHttpRequestBase())
         : authClient.ProcessUserAuthorization());
 }
Exemple #12
0
        private OAuth2Authenticator <AssertionFlowClient> ObjGetOAuth2(string thumb, string strServiceAccEmailId, string strScope)
        {
            string scopeUrl         = "https://www.googleapis.com/auth/" + strScope;
            string strSrvAccEmailId = strServiceAccEmailId;

            AuthorizationServerDescription objAuthServerDesc = GoogleAuthenticationServer.Description;

            var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);

            store.Open(OpenFlags.ReadOnly);
            var cert = store.Certificates.Find(X509FindType.FindByThumbprint, thumb, false);

            if (cert.Count == 0)
            {
                Log.Error("GA Certificate not found by thumb '{0}'", thumb);
                throw new Exception("Certificate not found");
            }

            Log.Debug("certs found {0}, first: {1}", cert.Count, cert[0].FriendlyName);

            var objClient = new AssertionFlowClient(objAuthServerDesc, cert[0])
            {
                ServiceAccountId = strSrvAccEmailId, Scope = scopeUrl
            };

            var objAuth = new OAuth2Authenticator <AssertionFlowClient>(objClient, AssertionFlowClient.GetState);

            return(objAuth);
        }         // ObjGetOAuth2
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoredStateClient"/> class.
 /// </summary>
 /// <param name="authorizationServer">The token issuer.</param>
 /// <param name="clientIdentifier">The client identifier.</param>
 /// <param name="clientSecret">The client secret.</param>
 public StoredStateClient(AuthorizationServerDescription authorizationServer,
                          String clientIdentifier,
                          String clientSecret,
                          IAuthorizationState state)
     : base(authorizationServer, clientIdentifier, clientSecret)
 {
     this.State = state;
 }
        /// <summary>
        /// Writes a Google+ App Activity to Google logging that the user has voted on a PhotoHunt
        /// photo.
        /// </summary>
        /// <param name="user">The user who has voted.</param>
        /// <param name="voteTarget">The photo the user has voted on.</param>
        public void WriteGooglePlusVoteAppActivity(User user, Photo voteTarget)
        {
            // Write an app activity for the vote.
            // Set the auth state in a the superclass for the authorization call.
            _authState = CreateState(user.googleAccessToken, user.googleRefreshToken,
                                     user.googleExpiresAt.AddSeconds(user.googleExpiresIn * -1), user.googleExpiresAt);

            AuthorizationServerDescription description =
                GoogleAuthenticationServer.Description;
            var provider = new WebServerClient(description);

            provider.ClientIdentifier = CLIENT_ID;
            provider.ClientSecret     = CLIENT_SECRET;
            var authenticator =
                new OAuth2Authenticator <WebServerClient>(
                    provider,
                    GetAuthorization)
            {
                NoCaching = true
            };

            ps = new PlusService(new BaseClientService.Initializer()
            {
                Authenticator = authenticator
            });

            Moment    body   = new Moment();
            ItemScope target = new ItemScope();
            ItemScope result = new ItemScope();

            // The target (an image) will be parsed from this URL containing microdata.
            target.Url = BASE_URL + "photo.aspx?photoId=" + voteTarget.id;

            // Just use a static review result.
            result.Type = SCHEMA_REVIEW_TYPE;
            result.Name = "A vote for this PhotoHunt photo.";
            result.Url  = target.Url;
            result.Text = "This photo embodies " + voteTarget.themeDisplayName;

            body.Target = target;
            body.Result = result;
            body.Type   = REVIEW_ACTIVITY_TYPE;
            MomentsResource.InsertRequest insert =
                new MomentsResource.InsertRequest(
                    ps,
                    body,
                    "me",
                    MomentsResource.Collection.Vault);
            try
            {
                insert.Fetch();
            }
            catch (GoogleApiRequestException gare)
            {
                Debug.WriteLine("Error while writing app activity: " + gare.InnerException.Message +
                                "\nThis could happen if the Google+ proxy can't access your server.");
            }
        }
Exemple #15
0
 /// <summary>
 /// We enforce the provding of a <see cref="ClientCredentialApplicator"/> such that the consumer is forced to choose the method using which
 /// the client secret is sent to the authorization server.
 /// </summary>
 /// <param name="requestScopes">Set of scopes to inquire from the authorization server.</param>
 /// <param name="dataRequestUri">Location at which to inquire the data once the request is authenticated.</param>
 public AuthenticationClient(AuthorizationServerDescription description, string clientIdentifier,
                             ClientCredentialApplicator credentialApplicator, string[] requestScopes, string dataRequestUri,
                             IdentityProvider identityProvider)
     : base(description, clientIdentifier, credentialApplicator)
 {
     _requestScopes    = requestScopes;
     _requestUri       = dataRequestUri;
     _identityProvider = identityProvider;
 }
Exemple #16
0
    protected AuthorizationServerDescription Description()
    {
        AuthorizationServerDescription desc = new AuthorizationServerDescription();

        desc.AuthorizationEndpoint = new Uri(txtAuthURL.Text);
        desc.ProtocolVersion       = ProtocolVersion.V20;
        desc.TokenEndpoint         = new Uri(txtTokenURL.Text);
        return(desc);
    }
        private void InitializeWebServerClient()
        {
            var authServer = new AuthorizationServerDescription {
                AuthorizationEndpoint = new Uri(Paths.AuthorizationServerBaseAddress + Paths.AuthorizePath),
                TokenEndpoint         = new Uri(Paths.AuthorizationServerBaseAddress + Paths.TokenPath)
            };

            webServerClient = new WebServerClient(authServer, Clients.Client1.Id, Clients.Client1.Secret);
        }
Exemple #18
0
        private WebServerClient CreateOAuth2Client()
        {
            var serverDescription = new AuthorizationServerDescription {
                TokenEndpoint = new Uri(tokenEndpointTextBox.Text)
            };
            var client = new WebServerClient(serverDescription, oauth2ClientIdTextBox.Text, oauth2ClientSecretTextBox.Text);

            return(client);
        }
        private AuthorizationServerDescription Description()
        {
            AuthorizationServerDescription desc = new AuthorizationServerDescription();

            desc.AuthorizationEndpoint = new Uri(oAuth2AuthorizeEndpoint);
            desc.ProtocolVersion       = ProtocolVersion.V20;
            desc.TokenEndpoint         = new Uri(oAuth2TokenEndpoint);
            return(desc);
        }
Exemple #20
0
        private static void Main()
        {
            // DotNetOpenAuth only issues access tokens when the client uses an HTTPS connection. As we will most
            // likely run the server on our local development machine with only a self-signed SSL certificate, setting up
            // connection to the server will fail as the SSL certificate is considered invalid by the .NET framework.
            // To circumvent this, we add the line below that will consider all SSL certificates as valid, including
            // self-signed certificaties. Note: this should only be used for testing purposes.
            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;

            // The description of the authorization server to which we will be connecting. The most important component
            // is the token endpoint, which is the URL at which the server listens for token requests
            var authorizationServerDescription = new AuthorizationServerDescription
            {
                TokenEndpoint   = new Uri("https://localhost:44303/tokens"),
                ProtocolVersion = ProtocolVersion.V20
            };

            // Create the client with which we will be connecting to the server.
            var userAgentClient = new UserAgentClient(authorizationServerDescription, clientIdentifier: "demo-client-1", clientSecret: "demo-client-secret-1");

            // The scope that we request for the client. Note: this can also be null if we don't want to request any specific
            // scope or more than one scope if we want to request an access token that is valid for several scopes
            var clientScopes = new[] { "demo-scope-client-1" };

            // Request a new client access token for the specified scopes (http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.4)
            // This method will use the client identifier and client secret used when constructing the UserAgentClient instance
            var clientAccessToken = userAgentClient.GetClientAccessToken(clientScopes);

            // Output some information about the retrieved client access token
            Console.WriteLine("[RETRIEVED CLIENT ACCESS TOKEN]");
            Console.WriteLine("Access token: {0}", clientAccessToken.AccessToken);
            Console.WriteLine("Expiration time: {0}", clientAccessToken.AccessTokenExpirationUtc);
            Console.WriteLine("Scope: {0}", OAuthUtilities.JoinScopes(clientAccessToken.Scope));

            // The scope that we request for the user. Note: this can also be null if we don't want to request any specific
            // scope or more than one scope if we want to request an access token that is valid for several scopes
            var userScopes = new[] { "demo-scope-1" };

            // Request a new user access token for the specified user and the specified scopes (http://tools.ietf.org/html/draft-ietf-oauth-v2-31#page-35)
            var userAccessToken = userAgentClient.ExchangeUserCredentialForToken("demo-user-1", "demo-user-password-1", userScopes);

            // Output some information about the retrieved user access token
            Console.WriteLine("\n[RETRIEVED USER ACCESS TOKEN]");
            Console.WriteLine("Access token: {0}", userAccessToken.AccessToken);
            Console.WriteLine("Refresh token: {0}", userAccessToken.RefreshToken);
            Console.WriteLine("Expiration time: {0}", userAccessToken.AccessTokenExpirationUtc);
            Console.WriteLine("Scope: {0}", OAuthUtilities.JoinScopes(userAccessToken.Scope));

            var refreshed = userAgentClient.RefreshAuthorization(userAccessToken);

            Console.WriteLine("\n[REFRESHING USER ACCESS TOKEN]");
            Console.WriteLine("Access token refreshed: {0}", refreshed);

            Console.WriteLine("\nPress any key to exit...");
            Console.ReadKey();
        }
Exemple #21
0
        private UserAgentClient GetClient(Uri url)
        {
            var authServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = null,                 // We are not actually using authorization, just authentication.
                TokenEndpoint         = url
            };

            return(new UserAgentClient(authServer, ClientIdentifier, ClientCredentialApplicator.PostParameter(ClientSecret)));
        }
Exemple #22
0
        private void InitializeWcfConsumer()
        {
            var authServer = new AuthorizationServerDescription()
            {
                AuthorizationEndpoint = new Uri("http://localhost:50172/OAuth/Authorize"),
                TokenEndpoint         = new Uri("http://localhost:50172/OAuth/Token"),
            };

            this.wcf = new UserAgentClient(authServer, "sampleconsumer", "samplesecret");
        }
        public static WebServerClient InitializeWebServerClient()
        {
            var authorizationServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri(AuthorizationServerUri, AuthorizationEndpoint),
                TokenEndpoint         = new Uri(AuthorizationServerUri, TokenEndpoint),
            };

            return(new WebServerClient(authorizationServer, ClientId, ClientSecret));
        }
 static GoogleAuthenticationServer()
 {
     // Set the auth server description.
     Description = new AuthorizationServerDescription
     {
         AuthorizationEndpoint = new Uri("https://accounts.google.com/o/oauth2/auth"),
         TokenEndpoint         = new Uri("https://accounts.google.com/o/oauth2/token"),
         ProtocolVersion       = ProtocolVersion.V20,
     };
 }
Exemple #25
0
        private static void InitializeWebServerClient()
        {
            var authorizationServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri(authorizationServerUri, "/oauth2/authorize"),
                TokenEndpoint         = new Uri(authorizationServerUri, "/api/oauth2/token"),
            };

            _webServerClient = new WebServerClient(authorizationServer, "resource_owner_test", "resource_owner_test");
        }
Exemple #26
0
        public OAuthClient(string authorizationEndpoint, string tokenEndpoint, string clientId, string clientSecret)
        {
            var authServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri(authorizationEndpoint),
                TokenEndpoint         = new Uri(tokenEndpoint)
            };

            _webServerClient = new WebServerClient(authServer, clientId, clientSecret);
        }
        private static void InitializeWebServerClient()
        {
            var authorizationServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri("https://login.windows.net/e27023d0-bf6d-47f1-94be-a75cae8debcd/oauth2/authorize" /* WHAT TO PUT HERE */),
                TokenEndpoint         = new Uri("https://login.windows.net/e27023d0-bf6d-47f1-94be-a75cae8debcd/oauth2/token" /* WHAT TO PUT HERE */)
            };

            _webServerClient = new WebServerClient(authorizationServer, clientId, appKey);
        }
        public OauthAuthenticationService(IAuthenticationManager signInManager)
        {
            this._signInManager = signInManager;
            var authorizationServer = new AuthorizationServerDescription
            {
                TokenEndpoint = new Uri(AddressPath.ServerToken)
            };

            _webServerClient = new WebServerClient(authorizationServer, this._clientId, this._clientSecret);
        }
        private static void InitializeWebServerClient()
        {
            var authorizationServerUri = new Uri(Paths.AuthorizationServerBaseAddress);
            var authorizationServer    = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri(authorizationServerUri, Paths.AuthorizePath),
                TokenEndpoint         = new Uri(authorizationServerUri, Paths.TokenPath)
            };

            _webServerClient = new WebServerClient(authorizationServer, "5", "6");
        }
Exemple #30
0
        private static WebServerClient _getClient()
        {
            var resourceServerURI   = new Uri(Paths.ResourceServerBaseAddress);
            var authorizationServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri(resourceServerURI, Paths.AuthorizePath),
                TokenEndpoint         = new Uri(resourceServerURI, Paths.TokenPath)
            };

            return(new WebServerClient(authorizationServer, Clients.Client1.Id, Clients.Client1.Secret));
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="EndUserAuthorizationImplicitRequestC"/> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		internal EndUserAuthorizationImplicitRequestC(AuthorizationServerDescription authorizationServer)
			: base(authorizationServer.AuthorizationEndpoint, authorizationServer.Version) {
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="AccessTokenAuthorizationCodeRequest"/> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		internal AccessTokenAuthorizationCodeRequest(AuthorizationServerDescription authorizationServer)
			: this(authorizationServer.TokenEndpoint, authorizationServer.Version)
		{
			Contract.Requires<ArgumentNullException>(authorizationServer != null);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="EndUserAuthorizationRequest"/> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		internal EndUserAuthorizationRequest(AuthorizationServerDescription authorizationServer)
			: this(authorizationServer.AuthorizationEndpoint, authorizationServer.Version) {
			Contract.Requires<ArgumentNullException>(authorizationServer != null);
			Contract.Requires<ArgumentException>(authorizationServer.Version != null);
			Contract.Requires<ArgumentException>(authorizationServer.AuthorizationEndpoint != null);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="EndUserAuthorizationRequestC"/> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		internal EndUserAuthorizationRequestC(AuthorizationServerDescription authorizationServer)
			: base(authorizationServer.AuthorizationEndpoint, authorizationServer.Version) {
			Requires.NotNull(authorizationServer, "authorizationServer");
			Requires.True(authorizationServer.Version != null, "authorizationServer");
			Requires.True(authorizationServer.AuthorizationEndpoint != null, "authorizationServer");
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="AccessTokenAuthorizationCodeRequest"/> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		internal AccessTokenAuthorizationCodeRequest(AuthorizationServerDescription authorizationServer)
			: this(authorizationServer.TokenEndpoint, authorizationServer.Version) {
			Requires.NotNull(authorizationServer, "authorizationServer");
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="AccessTokenRefreshRequest"/> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		internal AccessTokenRefreshRequest(AuthorizationServerDescription authorizationServer)
			: this(authorizationServer.TokenEndpoint, authorizationServer.Version) {
		}