Table of Contents

Class AbstractBasicAuthenticationClient

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

Abstract base class for an authentication client that obtains access tokens using the OAuth 2.0 client credentials grant with HTTP Basic Authentication.

public abstract class AbstractBasicAuthenticationClient : IAuthenticationClient
Inheritance
AbstractBasicAuthenticationClient
Implements
Inherited Members

Constructors

AbstractBasicAuthenticationClient(HttpClient)

Initializes a new instance of AbstractBasicAuthenticationClient.

protected AbstractBasicAuthenticationClient(HttpClient httpClient)

Parameters

httpClient HttpClient

The HttpClient used to send token requests.

Exceptions

ArgumentNullException

Thrown when httpClient is null.

Properties

Password

Gets the password (client secret or API secret) used for Basic Authentication.

protected abstract string Password { get; }

Property Value

string

TokenUri

Gets the full URI of the token endpoint.

protected abstract Uri TokenUri { get; }

Property Value

Uri

Username

Gets the username (client ID or API key) used for Basic Authentication.

protected abstract string Username { get; }

Property Value

string

Methods

AddAdditionalHeaders(HttpRequestMessage)

Adds provider-specific headers to the token request. The default implementation is a no-op.

protected virtual void AddAdditionalHeaders(HttpRequestMessage request)

Parameters

request HttpRequestMessage

The outgoing HttpRequestMessage to augment.

RequestClientCredentialsTokenAsync(CancellationToken)

Sends a token request using the client_credentials grant type.

public Task<TokenResponse?> RequestClientCredentialsTokenAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token that can be used to cancel the work.

Returns

Task<TokenResponse>

An instance of TokenResponse containing the token or null.