Class AuthenticationHandler
This handler appends OAuth2 Bearer tokens for allowed base uris
Inheritance
System.Object
AuthenticationHandler
Namespace: Dangl.RestClient
Assembly: Dangl.RestClient.dll
Syntax
public class AuthenticationHandler : DelegatingHandler
Constructors
| Improve this Doc View SourceAuthenticationHandler(ITokenStorage, ITokenHandler, String[])
This handler appends OAuth2 Bearer tokens for allowed base uris
Declaration
public AuthenticationHandler(ITokenStorage tokenStorage, ITokenHandler tokenHandler, params string[] baseUrls)
Parameters
Type | Name | Description |
---|---|---|
ITokenStorage | tokenStorage | |
ITokenHandler | tokenHandler | If no value is provided, a NoOpTokenHandler is used |
System.String[] | baseUrls |
Fields
| Improve this Doc View SourceTOKEN_EXPIRY_SAFETY_MARGIN_SECONDS
If OAuth2 tokens have less than this amount of time left, the handler will try to refresh them.
Declaration
public const int TOKEN_EXPIRY_SAFETY_MARGIN_SECONDS = null
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceSendAsync(HttpRequestMessage, CancellationToken)
Will append the OAuth2 Bearer token if no Authorization header is present, a valid token is available in the storage and the base url is in the list of allowed base urls
Declaration
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |