示例#1
0
        public TrustPolicyResolver(TrustPolicyServiceResolverSettings settings)
        {
            ClientSettings settings1 = settings.ClientSettings;

            var incomingCacheSettings =
                new CacheSettings(settings.CacheSettings)
            {
                Name = "BundleCache.incoming"
            };

            var outgoingCacheSettings =
                new CacheSettings(settings.CacheSettings)
            {
                Name = "BundleCache.outgoing"
            };

            m_incomingResolver =
                new PolicyResolver(new CertPolicyIndex(settings1, true, CertPolicyUse.TRUST), incomingCacheSettings);

            m_outgoingResolver =
                new PolicyResolver(new CertPolicyIndex(settings1, false, CertPolicyUse.TRUST), outgoingCacheSettings);
        }
示例#2
0
        void Verify(PolicySettings settings)
        {
            Assert.NotNull(settings.Resolvers);
            Assert.Equal(3, settings.Resolvers.Count());
            IPolicyResolver trustResolver   = settings.Resolvers.FirstOrDefault(r => r.Name == CertPolicyResolvers.TrustPolicyName).CreateResolver();
            IPolicyResolver privateResolver = settings.Resolvers.FirstOrDefault(r => r.Name == CertPolicyResolvers.PrivatePolicyName).CreateResolver();
            IPolicyResolver publicResolver  = settings.Resolvers.FirstOrDefault(r => r.Name == CertPolicyResolvers.PublicPolicyName).CreateResolver();

            Assert.NotNull(trustResolver);
            Assert.NotNull(privateResolver);
            Assert.NotNull(publicResolver);

            TrustPolicyServiceResolverSettings trustSettings =
                settings.Resolvers.FirstOrDefault(r => r.Name == CertPolicyResolvers.TrustPolicyName) as
                TrustPolicyServiceResolverSettings;

            Assert.True(trustSettings.CacheSettings.Cache);
            Assert.True(trustSettings.CacheSettings.NegativeCache);
            Assert.Equal(60, trustSettings.CacheSettings.CacheTTLSeconds);

            PrivatePolicyServiceResolverSettings privateSettings =
                settings.Resolvers.FirstOrDefault(r => r.Name == CertPolicyResolvers.PrivatePolicyName) as
                PrivatePolicyServiceResolverSettings;

            Assert.True(privateSettings.CacheSettings.Cache);
            Assert.True(privateSettings.CacheSettings.NegativeCache);
            Assert.Equal(60, privateSettings.CacheSettings.CacheTTLSeconds);


            PublicPolicyServiceResolverSettings publicSettings =
                settings.Resolvers.FirstOrDefault(r => r.Name == CertPolicyResolvers.PublicPolicyName) as
                PublicPolicyServiceResolverSettings;

            Assert.True(publicSettings.CacheSettings.Cache);
            Assert.True(publicSettings.CacheSettings.NegativeCache);
            Assert.Equal(60, publicSettings.CacheSettings.CacheTTLSeconds);
        }