Table of Contents

Class HttpClientAuthenticationConnection

Namespace
Auth0.AuthenticationApi
Assembly
Auth0.AuthenticationApi.dll

Implements the IAuthenticationConnection using HttpClient which can be either supplied or automatically managed.

public class HttpClientAuthenticationConnection : IAuthenticationConnection, IDisposable
Inheritance
HttpClientAuthenticationConnection
Implements
Inherited Members

Constructors

HttpClientAuthenticationConnection(HttpClient)

Initializes a new instance of the HttpClientAuthenticationConnection class.

public HttpClientAuthenticationConnection(HttpClient httpClient = null)

Parameters

httpClient HttpClient

Optional HttpClient to use when sending requests.

Remarks

If you supply a HttpClient it is your responsibility to manage its lifecycle and dispose it when appropriate. If you do not supply a HttpClient one will be created automatically and disposed of when this object is disposed.

HttpClientAuthenticationConnection(HttpMessageHandler)

Initializes a new instance of the HttpClientAuthenticationConnection class with a specific HttpMessageHandler.

public HttpClientAuthenticationConnection(HttpMessageHandler handler)

Parameters

handler HttpMessageHandler

HttpMessageHandler to use within the managed HttpClient.

Methods

Dispose()

Disposes of any owned disposable resources such as the underlying HttpClient if owned.

public void Dispose()

Dispose(bool)

Disposes of any owned disposable resources such as the underlying HttpClient if owned.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Whether we are actually disposing (true) or not (false).

GetAsync<T>(Uri, IDictionary<string, string>, CancellationToken)

Send a HTTP GET request to the given uri with optional headers as an asynchronous operation.

public Task<T> GetAsync<T>(Uri uri, IDictionary<string, string> headers = null, CancellationToken cancellationToken = default)

Parameters

uri Uri

Absolute Uri to send the request to.

headers IDictionary<string, string>

Optional dictionary containing additional headers to be sent.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task<T>

The task object representing the asynchronous operation.

Type Parameters

T

Type of object to deserialize the result into.

SendAsync<T>(HttpMethod, Uri, object, IDictionary<string, string>, CancellationToken)

Send an HTTP request to uri using the HTTP method as an asynchronous operation.

public Task<T> SendAsync<T>(HttpMethod method, Uri uri, object body, IDictionary<string, string> headers = null, CancellationToken cancellationToken = default)

Parameters

method HttpMethod

HttpMethod to use.

uri Uri

Absolute Uri to send the request to.

body object

Body of the HTTP request that will be sent.

headers IDictionary<string, string>

Optional dictionary containing additional headers to be sent.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task<T>

The task object representing the asynchronous operation.

Type Parameters

T

Type of object to deserialize the result into.