public StartupCertificateLoader(
     IEnumerable <ICertificateSource> certSources,
     CertificateSelector selector)
 {
     _certSources = certSources;
     _selector    = selector;
 }
示例#2
0
 public BeginCertificateCreationState(AcmeStateMachineContext context, ILogger <ServerStartupState> logger,
                                      IOptions <LettuceEncryptOptions> options, AcmeCertificateFactory acmeCertificateFactory,
                                      CertificateSelector selector, IEnumerable <ICertificateRepository> certificateRepositories) : base(context)
 {
     _logger  = logger;
     _options = options;
     _acmeCertificateFactory = acmeCertificateFactory;
     _selector = selector;
     _certificateRepositories = certificateRepositories;
 }
 public ServerStartupState(
     AcmeStateMachineContext context,
     IOptions <LettuceEncryptOptions> options,
     CertificateSelector selector,
     ILogger <ServerStartupState> logger) :
     base(context)
 {
     _options  = options;
     _selector = selector;
     _logger   = logger;
 }
示例#4
0
        internal static void AddCertificateSelector(MSI.MonoTlsSettings settings, CertificateSelector selector)
        {
            if (selector == null)
            {
                return;
            }

            settings.ClientCertificateSelectionCallback = (t, lc, rc, ai) => {
                return(selector.SelectionCallback(null, t, lc, rc, ai));
            };
        }
 public CheckForRenewalState(
     AcmeStateMachineContext context,
     ILogger <CheckForRenewalState> logger,
     IOptions <LettuceEncryptOptions> options,
     CertificateSelector selector,
     IClock clock) : base(context)
 {
     _logger   = logger;
     _options  = options;
     _selector = selector;
     _clock    = clock;
 }
示例#6
0
        public void ItUsesCertCommonName()
        {
            const string CommonName = "selector.letsencrypt.natemcmaster.com";

            var testCert = CreateTestCert(CommonName);
            var selector = new CertificateSelector(Options.Create(new LetsEncryptOptions()));

            selector.Add(testCert);

            var domain = Assert.Single(selector.SupportedDomains);

            Assert.Equal(CommonName, domain);
        }
示例#7
0
        public void ItUsesSubjectAlternativeName()
        {
            var domainNames = new[]
            {
                "san1.letsencrypt.natemcmaster.com",
                "san2.letsencrypt.natemcmaster.com",
                "san3.letsencrypt.natemcmaster.com",
            };
            var testCert = CreateTestCert(domainNames);
            var selector = new CertificateSelector(Options.Create(new LetsEncryptOptions()));

            selector.Add(testCert);


            Assert.Equal(
                new HashSet <string>(domainNames),
                new HashSet <string>(selector.SupportedDomains));
        }
示例#8
0
        public void ItSelectsCertificateWithLongestTTL()
        {
            const string CommonName = "test.natemcmaster.com";
            var          fiveDays   = CreateTestCert(CommonName, DateTimeOffset.Now.AddDays(5));
            var          tenDays    = CreateTestCert(CommonName, DateTimeOffset.Now.AddDays(10));

            var selector = new CertificateSelector(Options.Create(new LetsEncryptOptions()));

            selector.Add(fiveDays);
            selector.Add(tenDays);

            Assert.Same(tenDays, selector.Select(Mock.Of <ConnectionContext>(), CommonName));

            selector.Reset(CommonName);

            Assert.Null(selector.Select(Mock.Of <ConnectionContext>(), CommonName));

            selector.Add(tenDays);
            selector.Add(fiveDays);

            Assert.Same(tenDays, selector.Select(Mock.Of <ConnectionContext>(), CommonName));
        }
 public CertificateNotFoundException(CertificateSelector selector)
 {
     _selector = selector;
 }
示例#10
0
 internal static void SetCertificateSelector(CertificateSelector certificateSelector)
 {
     _certificateSelector = certificateSelector;
 }