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
HttpClientOptional 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
HttpMessageHandlerHttpMessageHandler 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
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
UriAbsolute Uri to send the request to.
headers
IDictionary<string, string>Optional dictionary containing additional headers to be sent.
cancellationToken
CancellationTokenThe 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
HttpMethodHttpMethod to use.
uri
UriAbsolute Uri to send the request to.
body
objectBody of the HTTP request that will be sent.
headers
IDictionary<string, string>Optional dictionary containing additional headers to be sent.
cancellationToken
CancellationTokenThe 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.