/// <summary>
        /// Adds the necessary HTTP Authorization header to an HTTP request for protected resources
        /// so that the Service Provider will allow the request through.
        /// </summary>
        /// <param name="requestHeaders">The headers on the request for protected resources from the service provider.</param>
        /// <param name="accessToken">The access token previously obtained from the Authorization Server.</param>
        public static void AuthorizeRequest(WebHeaderCollection requestHeaders, string accessToken)
        {
            Requires.NotNull(requestHeaders, "requestHeaders");
            Requires.NotNullOrEmpty(accessToken, "accessToken");

            OAuthUtilities.AuthorizeWithBearerToken(requestHeaders, accessToken);
        }
Example #2
0
        /// <summary>
        /// Adds the necessary HTTP Authorization header to an HTTP request for protected resources
        /// so that the Service Provider will allow the request through.
        /// </summary>
        /// <param name="request">The request for protected resources from the service provider.</param>
        /// <param name="accessToken">The access token previously obtained from the Authorization Server.</param>
        public static void AuthorizeRequest(HttpWebRequest request, string accessToken)
        {
            Requires.NotNull(request, "request");
            Requires.NotNullOrEmpty(accessToken, "accessToken");

            OAuthUtilities.AuthorizeWithBearerToken(request, accessToken);
        }