コード例 #1
0
        public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable()
        {
            var  instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });
            bool result   = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable);

            result.ShouldBe(false);
        }
        public void ValidatorShouldReturnFalseWhenPassedATrustedCertificateWhichDoesNotHaveAWhitelistedSubjectKeyIdentifier()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });
            var certificateChain = new X509Chain();
            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(false);
        }
コード例 #3
0
        public void ValidatorShouldReturnFalseWhenPassedATrustedCertificateWhichDoesNotHaveAWhitelistedSubjectKeyIdentifier()
        {
            var instance         = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });
            var certificateChain = new X509Chain();

            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(false);
        }
コード例 #4
0
        public TwitterAuthenticationOptions()
            : base(Constants.DefaultAuthenticationType)
        {
            Caption            = Constants.DefaultAuthenticationType;
            CallbackPath       = new PathString("/signin-twitter");
            AuthenticationMode = AuthenticationMode.Passive;
            BackchannelTimeout = TimeSpan.FromSeconds(60);

            // Twitter lists its valid Subject Key Identifiers at https://dev.twitter.com/docs/security/using-ssl
            BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(
                new[]
            {
                "A5EF0B11CEC04103A34A659048B21CE0572D7D47",     // VeriSign Class 3 Secure Server CA - G2
                "0D445C165344C1827E1D20AB25F40163D8BE79A5",     // VeriSign Class 3 Secure Server CA - G3
            });
        }
コード例 #5
0
        public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasAChainElementSubjectKeyIdentifierWhiteListed()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(
                new[]
            {
                MicrosoftInternetAuthorityKeyIdentifier
            });
            var certificateChain = new X509Chain();

            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(true);
        }
コード例 #6
0
        public TwitterAuthenticationOptions()
            : base(Constants.DefaultAuthenticationType)
        {
            Caption = Constants.DefaultAuthenticationType;
            CallbackPath = new PathString("/signin-twitter");
            AuthenticationMode = AuthenticationMode.Passive;
            BackchannelTimeout = TimeSpan.FromSeconds(60);

            // Twitter lists its valid Subject Key Identifiers at https://dev.twitter.com/docs/security/using-ssl
            BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(
                new[]
                {
                    "A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2
                    "0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3
                });
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TwitterAuthenticationOptions"/> class.
        /// </summary>
        public TwitterAuthenticationOptions()
        {
            AuthenticationScheme = TwitterAuthenticationDefaults.AuthenticationScheme;
            Caption = AuthenticationScheme;
            CallbackPath = new PathString("/signin-twitter");
            BackchannelTimeout = TimeSpan.FromSeconds(60);
#if DNX451
            // Twitter lists its valid Subject Key Identifiers at https://dev.twitter.com/docs/security/using-ssl
            BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(
                new[]
                {
                    "A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2
                    "0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3
                    "5F60CF619055DF8443148A602AB2F57AF44318EF", // Symantec Class 3 Secure Server CA - G4
                });
#endif
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TwitterAuthenticationOptions"/> class.
        /// </summary>
        public TwitterAuthenticationOptions()
        {
            AuthenticationScheme = TwitterAuthenticationDefaults.AuthenticationScheme;
            Caption            = AuthenticationScheme;
            CallbackPath       = new PathString("/signin-twitter");
            BackchannelTimeout = TimeSpan.FromSeconds(60);
#if DNX451
            // Twitter lists its valid Subject Key Identifiers at https://dev.twitter.com/docs/security/using-ssl
            BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(
                new[]
            {
                "A5EF0B11CEC04103A34A659048B21CE0572D7D47",     // VeriSign Class 3 Secure Server CA - G2
                "0D445C165344C1827E1D20AB25F40163D8BE79A5",     // VeriSign Class 3 Secure Server CA - G3
                "5F60CF619055DF8443148A602AB2F57AF44318EF",     // Symantec Class 3 Secure Server CA - G4
            });
#endif
        }
コード例 #9
0
        public DeveloperAuthenticationOptions()
            : base("DeveloperAuth")
        {
            Caption            = "DeveloperAuth";
            CallbackPath       = new PathString("/signin-developerauth");
            AuthenticationMode = AuthenticationMode.Passive;
            BackchannelTimeout = TimeSpan.FromSeconds(60);

            // Twitter lists its valid Subject Key Identifiers at https://dev.twitter.com/docs/security/using-ssl
            BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(
                new[]
            {
                "A5EF0B11CEC04103A34A659048B21CE0572D7D47",     // VeriSign Class 3 Secure Server CA - G2
                "0D445C165344C1827E1D20AB25F40163D8BE79A5",     // VeriSign Class 3 Secure Server CA - G3
                "5F60CF619055DF8443148A602AB2F57AF44318EF",     // Symantec Class 3 Secure Server CA - G4
            });
        }
        public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasItsSubjectKeyIdentifierWhiteListed()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(
                new[]
                {
                    KatanaTestKeyIdentifier
                });

            var certificateChain = new X509Chain();
            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(true);
        }
 public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable()
 {
     var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });
     bool result = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable);
     result.ShouldBe(false);
 }
        public void ConstructorShouldNotThrowWithValidValues()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });

            instance.ShouldNotBe(null);
        }
コード例 #13
0
        public void ConstructorShouldNotThrowWithValidValues()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });

            instance.ShouldNotBe(null);
        }