Class MassiveAuthenticationHandler
- Namespace
- MassiveDotNet.Http
- Assembly
- MassiveDotNet.dll
Attaches Massive platform credentials to every outbound request.
public sealed class MassiveAuthenticationHandler : DelegatingHandler, IDisposable
- Inheritance
-
MassiveAuthenticationHandler
- Implements
- Inherited Members
Constructors
MassiveAuthenticationHandler(string, MassiveAuthenticationScheme)
Initializes a new instance of the MassiveAuthenticationHandler class.
public MassiveAuthenticationHandler(string apiKey, MassiveAuthenticationScheme scheme)
Parameters
apiKeystringThe API key to present.
schemeMassiveAuthenticationSchemeHow the key should be presented.
Exceptions
- ArgumentException
apiKeyis null or whitespace.
Methods
Send(HttpRequestMessage, CancellationToken)
Sends an HTTP request to the inner handler to send to the server.
protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message to send to the server.
cancellationTokenCancellationTokenA cancellation token to cancel operation.
Returns
- HttpResponseMessage
An HTTP response message.
Exceptions
- OperationCanceledException
The cancellation token was canceled. This exception is stored into the returned task.
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.- OperationCanceledException
The cancellation token was canceled. This exception is stored into the returned task.