Class AuthenticationHandler
- Namespace
- Cloudflare.NET.Core.Auth
- Assembly
- Cloudflare.NET.dll
A delegating handler that injects the Cloudflare API token into the Authorization header of each outgoing request.
public class AuthenticationHandler : DelegatingHandler, IDisposable
- Inheritance
-
AuthenticationHandler
- Implements
- Inherited Members
Remarks
Initializes a new instance of the AuthenticationHandler class.
Constructors
AuthenticationHandler(IOptions<CloudflareApiOptions>, ILogger<AuthenticationHandler>)
A delegating handler that injects the Cloudflare API token into the Authorization header of each outgoing request.
public AuthenticationHandler(IOptions<CloudflareApiOptions> options, ILogger<AuthenticationHandler> logger)
Parameters
optionsIOptions<CloudflareApiOptions>The Cloudflare API options containing the token.
loggerILogger<AuthenticationHandler>The logger for this handler.
Remarks
Initializes a new instance of the AuthenticationHandler class.
Methods
SendAsync(HttpRequestMessage, CancellationToken)
Overrides the SendAsync method to add the Authorization header.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<HttpResponseMessage>
The HTTP response message.