コード例 #1
0
        public void Constructor_throws_when_a_client_secret_is_not_Base64UrlEncoded()
        {
            var settings = new JwtOAuthServerSettings
            {
                AllowedClients =
                {
                    new JwtOAuthClient
                    {
                        Id     = "valid_client_id",
                        Secret = "invalid secret"
                    }
                }
            };

            Assert.Throws <FormatException>(() => new JwtAccessTokenFormat(settings));
        }
コード例 #2
0
        public void Constructor_throws_when_certificate_configuration_is_ambiguous()
        {
            var settings = new JwtOAuthServerSettings
            {
                AllowedClients =
                {
                    new JwtOAuthClient
                    {
                        Id     = "valid_client_id",
                        Secret = "JkgHgUR3npkGFrHOXOph1R_NBtp6GikiWv_CKNt_xXU",
                        RelativeFileCertificate = new RelativeFileCertificate(),
                        StoreCertificate        = new StoreCertificate()
                    }
                }
            };

            Assert.Throws <InvalidOperationException>(() => new JwtAccessTokenFormat(settings));
        }
コード例 #3
0
        public void Constructor_throws_when_certificate_cannot_be_loaded()
        {
            var settings = new JwtOAuthServerSettings
            {
                AllowedClients =
                {
                    new JwtOAuthClient
                    {
                        Id               = "valid_client_id",
                        Secret           = "JkgHgUR3npkGFrHOXOph1R_NBtp6GikiWv_CKNt_xXU",
                        StoreCertificate = new StoreCertificate
                        {
                            CertificateThumbprint = "invalidthumbprint"
                        }
                    }
                }
            };

            Assert.Throws <InvalidOperationException>(() => new JwtAccessTokenFormat(settings));
        }