Table of Contents

Class AuthenticationHandlerBase

Namespace
Apizr.Authenticating
Assembly
Apizr.dll

The authentication handler base implementation

public abstract class AuthenticationHandlerBase : DelegatingHandler, IDisposable, IAuthenticationHandler
Inheritance
AuthenticationHandlerBase
Implements
Derived
Inherited Members

Constructors

AuthenticationHandlerBase(IApizrManagerOptionsBase)

The authentication handler constructor

protected AuthenticationHandlerBase(IApizrManagerOptionsBase apizrOptions)

Parameters

apizrOptions IApizrManagerOptionsBase

The Apizr options

Fields

ApizrOptions

protected readonly IApizrManagerOptionsBase ApizrOptions

Field Value

IApizrManagerOptionsBase

Methods

CloneHttpRequestMessageAsync(HttpRequestMessage)

Clone a HttpRequestMessage

protected Task<HttpRequestMessage> CloneHttpRequestMessageAsync(HttpRequestMessage request)

Parameters

request HttpRequestMessage

The request

Returns

Task<HttpRequestMessage>

A copy of the request

GetTokenAsync(HttpRequestMessage, CancellationToken)

The method called to get local token

public abstract Task<string> GetTokenAsync(HttpRequestMessage request, CancellationToken ct = default)

Parameters

request HttpRequestMessage

The request to authenticate

ct CancellationToken

The cancellation token

Returns

Task<string>

The saved token

RefreshTokenAsync(HttpRequestMessage, string, CancellationToken)

The method called to refresh token when rejected or empty

public abstract Task<string> RefreshTokenAsync(HttpRequestMessage request, string token, CancellationToken ct = default)

Parameters

request HttpRequestMessage

The request to authenticate

token string

The former token

ct CancellationToken

The cancellation token

Returns

Task<string>

The refreshed token

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

request HttpRequestMessage

The HTTP request message to send to the server.

cancellationToken CancellationToken

A cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

Returns Task<TResult>. The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

The request was null.

SetTokenAsync(HttpRequestMessage, string, CancellationToken)

The method called to set local token

public abstract Task SetTokenAsync(HttpRequestMessage request, string token, CancellationToken ct = default)

Parameters

request HttpRequestMessage

The request to authenticate

token string

The token to save

ct CancellationToken

The cancellation token

Returns

Task