Example #1
0
        public void LetsEncryptAcmeClientHasDirectoryWithUri()
        {
            var acmeClientCreateTask = AcmeClient.CreateAsync(letsEncryptUri);

            using (var acmeClient = acmeClientCreateTask.GetAwaiter().GetResult())
            {
                var acmeDirectory = acmeClient.Directory;
                Assert.NotNull(acmeDirectory.KeyChangeUri);
                Assert.NotNull(acmeDirectory.NewAuthzUri);
                Assert.NotNull(acmeDirectory.NewCertUri);
                Assert.NotNull(acmeDirectory.NewRegistrationUri);
                Assert.NotNull(acmeDirectory.RevokeCertUri);
            }
        }
Example #2
0
        private static void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(typeof(Program).Assembly);
            services.AddSingleton(serviceProvider =>
            {
                var directoryUri = serviceProvider.GetService <IConfiguration>()?[AcmeDirectoryConfigKey];
                var httpHandler  = serviceProvider.GetService <HttpMessageHandler>();
                var acmeLogger   = serviceProvider.GetService <ILogger <AcmeClient> >();

                return(AcmeClient.CreateAsync(
                           directoryUri.NotNullOrWhiteSpace(otherwise: LetsEncrypt.DirectoryUri),
                           httpHandler, disposeHandler: false
                           ).ConfigureAwait(false).GetAwaiter().GetResult());
            });
        }
Example #3
0
        public void LetsEncryptAcmeClientHasDirectoryWithUriStringAndHttpClient()
        {
            var letsEncryptDirectoryUri = new Uri(letsEncryptUri, "directory");
            var acmeClientCreateTask    = AcmeClient.CreateAsync(LetsEncrypt.DirectoryUri, httpHandler, disposeHandler: false);

            using (var acmeClient = acmeClientCreateTask.GetAwaiter().GetResult())
            {
                var acmeDirectory = acmeClient.Directory;
                Assert.NotNull(acmeDirectory.KeyChangeUri);
                Assert.NotNull(acmeDirectory.NewAuthzUri);
                Assert.NotNull(acmeDirectory.NewCertUri);
                Assert.NotNull(acmeDirectory.NewRegistrationUri);
                Assert.NotNull(acmeDirectory.RevokeCertUri);
            }
        }