Class AuthenticationHandler
- Namespace
- Apizr.Authenticating
- Assembly
- Apizr.dll
The authentication handler implementation refreshing token
public class AuthenticationHandler : AuthenticationHandlerBase, IDisposable, IAuthenticationHandler
- Inheritance
-
AuthenticationHandler
- Implements
- Inherited Members
Constructors
AuthenticationHandler(IApizrManagerOptionsBase, Func<HttpRequestMessage, string, CancellationToken, Task<string>>)
The authentication handler constructor
public AuthenticationHandler(IApizrManagerOptionsBase apizrOptions, Func<HttpRequestMessage, string, CancellationToken, Task<string>> refreshTokenFactory)
Parameters
apizrOptions
IApizrManagerOptionsBaseThe Apizr options
refreshTokenFactory
Func<HttpRequestMessage, string, CancellationToken, Task<string>>The refresh token factory
Exceptions
AuthenticationHandler(IApizrManagerOptionsBase, Func<HttpRequestMessage, CancellationToken, Task<string>>)
The authentication handler constructor
public AuthenticationHandler(IApizrManagerOptionsBase apizrOptions, Func<HttpRequestMessage, CancellationToken, Task<string>> getTokenFactory)
Parameters
apizrOptions
IApizrManagerOptionsBaseThe Apizr options
getTokenFactory
Func<HttpRequestMessage, CancellationToken, Task<string>>The get token factory
Exceptions
AuthenticationHandler(IApizrManagerOptionsBase, Func<HttpRequestMessage, CancellationToken, Task<string>>, Func<HttpRequestMessage, string, CancellationToken, Task>)
The authentication handler constructor
public AuthenticationHandler(IApizrManagerOptionsBase apizrOptions, Func<HttpRequestMessage, CancellationToken, Task<string>> getTokenFactory, Func<HttpRequestMessage, string, CancellationToken, Task> setTokenFactory)
Parameters
apizrOptions
IApizrManagerOptionsBaseThe Apizr options
getTokenFactory
Func<HttpRequestMessage, CancellationToken, Task<string>>The get token factory
setTokenFactory
Func<HttpRequestMessage, string, CancellationToken, Task>The set token factory
Exceptions
AuthenticationHandler(IApizrManagerOptionsBase, Func<HttpRequestMessage, CancellationToken, Task<string>>, Func<HttpRequestMessage, string, CancellationToken, Task>, Func<HttpRequestMessage, string, CancellationToken, Task<string>>)
The authentication handler constructor
public AuthenticationHandler(IApizrManagerOptionsBase apizrOptions, Func<HttpRequestMessage, CancellationToken, Task<string>> getTokenFactory, Func<HttpRequestMessage, string, CancellationToken, Task> setTokenFactory, Func<HttpRequestMessage, string, CancellationToken, Task<string>> refreshTokenFactory)
Parameters
apizrOptions
IApizrManagerOptionsBaseThe Apizr options
getTokenFactory
Func<HttpRequestMessage, CancellationToken, Task<string>>The get token factory
setTokenFactory
Func<HttpRequestMessage, string, CancellationToken, Task>The set token factory
refreshTokenFactory
Func<HttpRequestMessage, string, CancellationToken, Task<string>>The refresh token factory
Exceptions
Methods
GetTokenAsync(HttpRequestMessage, CancellationToken)
The method called to get local token
public override Task<string> GetTokenAsync(HttpRequestMessage request, CancellationToken ct = default)
Parameters
request
HttpRequestMessagect
CancellationToken
Returns
RefreshTokenAsync(HttpRequestMessage, string, CancellationToken)
The method called to refresh token when rejected or empty
public override Task<string> RefreshTokenAsync(HttpRequestMessage request, string token, CancellationToken ct = default)
Parameters
request
HttpRequestMessageThe request to authenticate
token
stringThe former token
ct
CancellationTokenThe cancellation token
Returns
SetTokenAsync(HttpRequestMessage, string, CancellationToken)
The method called to set local token
public override Task SetTokenAsync(HttpRequestMessage request, string token, CancellationToken ct = default)
Parameters
request
HttpRequestMessageThe request to authenticate
token
stringThe token to save
ct
CancellationTokenThe cancellation token