Table of Contents

Class BearerTokenDelegatingHandler<TClient>

Namespace
Visus.AddressValidation.Http
Assembly
Visus.AddressValidation.dll

An HTTP delegate handler that injects a Bearer token into each request.

public sealed class BearerTokenDelegatingHandler<TClient> : DelegatingHandler, IDisposable where TClient : IAuthenticationClient

Type Parameters

TClient
Inheritance
BearerTokenDelegatingHandler<TClient>
Implements
Inherited Members

Constructors

BearerTokenDelegatingHandler(AbstractAuthenticationService<TClient>)

Initializes a new instance of BearerTokenDelegatingHandler<TClient>.

public BearerTokenDelegatingHandler(AbstractAuthenticationService<TClient> authenticationService)

Parameters

authenticationService AbstractAuthenticationService<TClient>

An instance of AbstractAuthenticationService<TClient> that retrieves the access_token.

Exceptions

ArgumentNullException

Thrown when authenticationService is null.

Methods

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

request HttpRequestMessage

The HTTP request message to send to the server.

cancellationToken CancellationToken

A cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

The request was null.

OperationCanceledException

The cancellation token was canceled. This exception is stored into the returned task.

InvalidCredentialException

Provided credentials were rejected by the server.