コード例 #1
0
        public async Task TestChallengeRequestHttp01()
        {
            var site = iisManager.GetSiteByDomain(testSiteDomain);

            Assert.AreEqual(site.Name, testSiteName);

            var dummyManagedSite = new ManagedSite
            {
                Id            = Guid.NewGuid().ToString(),
                Name          = testSiteName,
                GroupId       = site.Id.ToString(),
                RequestConfig = new CertRequestConfig
                {
                    PrimaryDomain                    = testSiteDomain,
                    ChallengeType                    = "http-01",
                    PerformAutoConfig                = true,
                    PerformAutomatedCertBinding      = true,
                    PerformChallengeFileCopy         = true,
                    PerformExtensionlessConfigChecks = true,
                    WebsiteRootPath                  = testSitePath
                },
                ItemType = ManagedItemType.SSL_LetsEncrypt_LocalIIS
            };

            var result = await certifyManager.PerformCertificateRequest(dummyManagedSite);

            //ensure cert request was successful
            Assert.IsTrue(result.IsSuccess, "Certificate Request Not Completed");

            //check details of cert, subject alternative name should include domain and expiry must be great than 89 days in the future
            var managedSites = await certifyManager.GetManagedSites();

            var managedSite = managedSites.FirstOrDefault(m => m.Id == dummyManagedSite.Id);

            //emsure we have a new managed site
            Assert.IsNotNull(managedSite);

            //have cert file details
            Assert.IsNotNull(managedSite.CertificatePath);

            var fileExists = System.IO.File.Exists(managedSite.CertificatePath);

            Assert.IsTrue(fileExists);

            //check cert is correct
            var certInfo = CertificateManager.LoadCertificate(managedSite.CertificatePath);

            Assert.IsNotNull(certInfo);

            bool isRecentlyCreated = Math.Abs((DateTime.UtcNow - certInfo.NotBefore).TotalDays) < 2;

            Assert.IsTrue(isRecentlyCreated);

            bool expiresInFuture = (certInfo.NotAfter - DateTime.UtcNow).TotalDays >= 89;

            Assert.IsTrue(expiresInFuture);

            // remove managed site
            await certifyManager.DeleteManagedSite(managedSite.Id);
        }
コード例 #2
0
        public void LoadSettings()
        {
            this.ManagedSites         = new ObservableCollection <ManagedSite>(certifyManager.GetManagedSites());
            this.ImportedManagedSites = new ObservableCollection <ManagedSite>();

            if (!this.ManagedSites.Any())
            {
                //if we have a vault, preview import. //TODO: make this async and only perform after UI has shown
                PreviewImport(sanMergeMode: true);

                //if we have no vault, start a new one

                //if we have no registered contacts in the vault then prompt to register a contact
            }

            /*if (this.ManagedSites.Any())
             * {
             *  //preselect the first managed site
             *  //  this.SelectedItem = this.ManagedSites[0];
             *
             *  //test state
             *  BeginTrackingProgress(new RequestProgressState { CurrentState = RequestState.InProgress, IsStarted = true, Message = "Registering Domain Identifier", ManagedItem = ManagedSites[0] });
             *  BeginTrackingProgress(new RequestProgressState { CurrentState = RequestState.Error, IsStarted = true, Message = "Rate Limited", ManagedItem = ManagedSites[0] });
             * }*/
        }
コード例 #3
0
ファイル: AppModel.cs プロジェクト: mangonugen/certify
        public void LoadSettings()
        {
            this.ManagedSites = new ObservableCollection <ManagedSite>(certifyManager.GetManagedSites());

            if (this.ManagedSites.Any())
            {
                //preselect the first managed site
                //  this.SelectedItem = this.ManagedSites[0];
            }
        }
コード例 #4
0
ファイル: AppModel.cs プロジェクト: azraelrabbit/certify
        public void LoadSettings()
        {
            this.ManagedSites         = new ObservableCollection <ManagedSite>(certifyManager.GetManagedSites());
            this.ImportedManagedSites = new ObservableCollection <ManagedSite>();

            /*if (this.ManagedSites.Any())
             * {
             *  //preselect the first managed site
             *  //  this.SelectedItem = this.ManagedSites[0];
             *
             *  //test state
             *  BeginTrackingProgress(new RequestProgressState { CurrentState = RequestState.InProgress, IsStarted = true, Message = "Registering Domain Identifier", ManagedItem = ManagedSites[0] });
             *  BeginTrackingProgress(new RequestProgressState { CurrentState = RequestState.Error, IsStarted = true, Message = "Rate Limited", ManagedItem = ManagedSites[0] });
             * }*/
        }