Class AuthorizedHttpMessageHandler
A DelegatingHandler that adds an Authorization header using a pre-defined
scheme and a value provided by subclass inheriting from this class.
public abstract class AuthorizedHttpMessageHandler : DelegatingHandler, IDisposable
- Inheritance
-
AuthorizedHttpMessageHandler
- Implements
- Derived
- Inherited Members
Constructors
AuthorizedHttpMessageHandler(string)
Initializes a new instance of the class.
protected AuthorizedHttpMessageHandler(string authorizationScheme)
Parameters
authorizationSchemestringThe authorization scheme name.
Methods
GetAuthorizationValueAsync()
The value for the authorization header.
protected abstract Task<string> GetAuthorizationValueAsync()
Returns
SendAsync(HttpRequestMessage, CancellationToken)
Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message to send to the server.
cancellationTokenCancellationTokenA cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
The
requestwas null.