示例#1
0
        /// <summary>
        /// Constructs a <see cref="DynamicRequestHeaderHandler"/>.
        /// </summary>
        /// <param name="dynamicHeaders">An enumerable set of <see cref="KeyValuePair{TKey, TValue}"/>s where each key is the name of a header and each value is a string returning function for the header value.</param>
        /// <param name="applyHeadersCondition">A <see cref="IRequestCondition"/> implementation used to determine if the dynamic headers should be applied. If null, headers are applied to all requests.</param>
        /// <param name="innerHandler">The next handler in the pipeline to pass requests to after the dynamic headers are added.</param>
        public DynamicRequestHeaderHandler(IEnumerable <KeyValuePair <string, Func <string> > > dynamicHeaders, IRequestCondition applyHeadersCondition, HttpMessageHandler innerHandler) : base(innerHandler)
        {
            if (dynamicHeaders == null)
            {
                throw new ArgumentNullException(nameof(dynamicHeaders));
            }

            _ApplyHeadersCondition = applyHeadersCondition;
            _DynamicHeaders        = dynamicHeaders;
        }
示例#2
0
        /// <summary>
        /// Constructs a new instance using the specified <see cref="OAuth2Settings"/>.
        /// </summary>
        /// <param name="settings">An <see cref="OAuth2Settings"/> instance containing details used to request and manage tokens and authentication flows.</param>
        /// <param name="innerHandler">The inner <see cref="System.Net.Http.HttpMessageHandler"/> to call in the pipeline.</param>
        /// <param name="requestCondition">An optional <see cref="IRequestCondition"/> used to determine if authorisation is required. If null, then authorisation is always performed.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="settings"/> is null.</exception>
        /// <exception cref="System.InvalidOperationException">Thrown if a validation error occurs for the <paramref name="settings"/> argument. See <see cref="OAuth2Settings.Validate"/>.</exception>
        public OAuth2RequestSigningHandler(OAuth2Settings settings, System.Net.Http.HttpMessageHandler innerHandler, IRequestCondition requestCondition) : base(innerHandler)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            settings.Validate();

            _Token            = settings.AccessToken;
            _RequestCondition = requestCondition;
            _Settings         = settings;
        }
示例#3
0
 /// <summary>
 /// Constructs a new instance using the specified <see cref="OAuth2Settings"/>.
 /// </summary>
 /// <param name="settings">An <see cref="OAuth2Settings"/> instance containing details used to request and manage tokens and authentication flows.</param>
 /// <param name="innerHandler">The inner <see cref="System.Net.Http.HttpMessageHandler"/> to call in the pipeline.</param>
 /// <param name="requestCondition">An optional <see cref="IRequestCondition"/> used to determine if authorisation is required. If null, then authorisation is always performed.</param>
 /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="settings"/> is null.</exception>
 public OAuth2RequestSigningHandler(OAuth2Settings settings, System.Net.Http.HttpMessageHandler innerHandler, IRequestCondition requestCondition) : base(innerHandler)
 {
     Helper.Throw();
 }
 /// <summary>
 /// Constructs a <see cref="DynamicRequestHeaderHandler"/>.
 /// </summary>
 /// <param name="dynamicHeaders">An enumerable set of <see cref="KeyValuePair{TKey, TValue}"/>s where each key is the name of a header and each value is a string returning function for the header value.</param>
 /// <param name="applyHeadersCondition">A <see cref="IRequestCondition"/> implementation used to determine if the dynamic headers should be applied. If null, headers are applied to all requests.</param>
 /// <param name="innerHandler">The next handler in the pipeline to pass requests to after the dynamic headers are added.</param>
 public DynamicRequestHeaderHandler(IEnumerable <KeyValuePair <string, Func <string> > > dynamicHeaders, IRequestCondition applyHeadersCondition, HttpMessageHandler innerHandler) : base(innerHandler)
 {
     Helper.Throw();
 }
 /// <summary>
 /// Full constructor.
 /// </summary>
 /// <param name="innerHandler">The next handler in the pipeline to pass requests through.</param>
 /// <param name="requestCondition">A <see cref="IRequestCondition"/> that controls whether any individual request is compressed or not. If null, all requests are compressed.</param>
 public CompressedRequestHandler(System.Net.Http.HttpMessageHandler innerHandler, IRequestCondition requestCondition) : base(innerHandler)
 {
     Helper.Throw();
 }
 /// <summary>
 /// Full constructor.
 /// </summary>
 /// <param name="innerHandler">The next handler in the pipeline to pass requests through.</param>
 /// <param name="requestCondition">A <see cref="IRequestCondition"/> that controls whether any individual request is compressed or not. If null, all requests are compressed.</param>
 public CompressedRequestHandler(System.Net.Http.HttpMessageHandler innerHandler, IRequestCondition requestCondition) : base(innerHandler)
 {
     _RequestCondition = requestCondition;
 }