Class HttpClientFactoryProvider
- Namespace
- SimpleSign.Core.Http
- Assembly
- SimpleSign.Core.dll
IHttpClientProvider backed by IHttpClientFactory.
Each call to GetClient() calls IHttpClientFactory.CreateClient(name),
which respects the named-client configuration and lifetime managed by the factory.
public sealed class HttpClientFactoryProvider : IHttpClientProvider
- Inheritance
-
HttpClientFactoryProvider
- Implements
- Inherited Members
Remarks
Register in ASP.NET Core:
services.AddHttpClient("SimpleSign", client =>
{
client.Timeout = TimeSpan.FromSeconds(10);
});
services.AddSimpleSign(); // auto-wired when IHttpClientFactory is in the container
Constructors
HttpClientFactoryProvider(IHttpClientFactory, string)
Creates a provider that resolves named clients from factory.
public HttpClientFactoryProvider(IHttpClientFactory factory, string clientName = "SimpleSign")
Parameters
factoryIHttpClientFactoryThe factory to delegate to.
clientNamestringThe named-client key passed to CreateClient(string). Defaults to
"SimpleSign".
Methods
GetClient()
Returns an HttpClient suitable for OCSP, CRL, TSA, and AIA requests.
public HttpClient GetClient()