Table of Contents

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

options IOptions<CloudflareApiOptions>

The Cloudflare API options containing the token.

logger ILogger<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

request HttpRequestMessage

The HTTP request message.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<HttpResponseMessage>

The HTTP response message.