Class DatavalidAccessTokenProvider
- Namespace
- NuvTools.Security.Biometrics.Serpro
- Assembly
- NuvTools.Security.Biometrics.Serpro.dll
Issues and caches the access token for the SERPRO API gateway (client credentials), so a verification does not pay for a token request each time.
public sealed class DatavalidAccessTokenProvider : IDisposable
- Inheritance
-
DatavalidAccessTokenProvider
- Implements
- Inherited Members
Constructors
DatavalidAccessTokenProvider(IHttpClientFactory, IOptions<DatavalidOptions>, TimeProvider)
Issues and caches the access token for the SERPRO API gateway (client credentials), so a verification does not pay for a token request each time.
public DatavalidAccessTokenProvider(IHttpClientFactory httpClientFactory, IOptions<DatavalidOptions> options, TimeProvider timeProvider)
Parameters
httpClientFactoryIHttpClientFactoryFactory for the client used to call the token endpoint.
optionsIOptions<DatavalidOptions>Datavalid configuration.
timeProviderTimeProviderClock the token's lifetime is measured with.
Fields
HttpClientName
Name of the HttpClient used to call the token endpoint.
public const string HttpClientName = "DatavalidToken"
Field Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetAsync(CancellationToken)
Returns the cached token, requesting a new one when there is none or it is about to expire.
public Task<string> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
Exceptions
- HttpRequestException
The gateway refused the credentials or could not be reached.
- InvalidOperationException
The gateway answered without a token.
Invalidate()
Discards the cached token, so the next call requests a new one. Called when the gateway refuses a token it issued.
public void Invalidate()