Exemplo n.º 1
0
        /// <summary>
        /// Add an OAuth header to this request.
        /// </summary>
        /// <param name="request">The request to which the header should be added.</param>
        /// <param name="headerFactory">OAuth header factory.</param>
        /// <returns>Async task</returns>
        public static async Task AddOAuthHeader(this HttpRequestMessage request, OAuthHeaderFactory headerFactory)
        {
            var headerParam = await headerFactory.GetAuthorisationHeaderParameter(request).ConfigureAwait(false);

            request.Headers.Authorization = new AuthenticationHeaderValue("OAuth", headerParam);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OAuthHttpMessageHandler"/> class,
 /// with the given delegate handler.
 /// </summary>
 /// <param name="config">OAuth config.</param>
 /// <param name="innerHandler">The handler to delegate to.</param>
 public OAuthHttpMessageHandler(OAuthConfig config, HttpMessageHandler innerHandler)
     : base(innerHandler)
 {
     this.headerFactory = new OAuthHeaderFactory(config);
 }