Exemplo n.º 1
0
 public AcmeClient(HttpClient httpClient, AcmeClientNonceHttpHandler nonceHandler, AcmeDirectory directory)
     : base()
 {
     this.httpClient   = httpClient;
     this.nonceHandler = nonceHandler;
     this.directory    = directory;
 }
Exemplo n.º 2
0
        private static async Task <AcmeClient> CreateAsync <TUri>(TUri directoryUri,
                                                                  Func <TUri, HttpRequestMessage> httpGetFactory,
                                                                  HttpMessageHandler httpHandler, bool disposeHandler,
                                                                  CancellationToken cancelToken = default)
        {
            if (httpHandler is null)
            {
                httpHandler    = new HttpClientHandler();
                disposeHandler = true;
            }

            var nonceHandler     = new AcmeClientNonceHttpHandler(httpHandler);
            var userAgentHandler = new AcmeClientHttpUserAgentHandler(nonceHandler);
            var httpClient       = new HttpClient(userAgentHandler, disposeHandler);

            var directory = await GetAcmeDirectoryAsync(directoryUri, httpClient,
                                                        httpGetFactory, cancelToken).ConfigureAwait(false);

            return(new AcmeClient(httpClient, nonceHandler, directory));
        }