public void NoCert_NoOp()
        {
            var httpContext = new DefaultHttpContext();
            var transform   = new RequestHeaderClientCertTransform();
            var result      = transform.Apply(httpContext, new HttpRequestMessage(), StringValues.Empty);

            Assert.Equal(StringValues.Empty, result);
        }
        public void ExistingHeader_NoCert_ReturnsEmpty()
        {
            var httpContext = new DefaultHttpContext();
            var transform   = new RequestHeaderClientCertTransform();
            var result      = transform.Apply(httpContext, new HttpRequestMessage(), "OtherValue");

            Assert.Equal(StringValues.Empty, result);
        }
        public void ExistingHeader_Replaced()
        {
            var httpContext = new DefaultHttpContext();

            httpContext.Connection.ClientCertificate = Certificates.SelfSignedValidWithClientEku;
            var transform = new RequestHeaderClientCertTransform();
            var result    = transform.Apply(httpContext, new HttpRequestMessage(), "OtherValue");
            var expected  = Convert.ToBase64String(Certificates.SelfSignedValidWithClientEku.RawData);

            Assert.Equal(expected, result);
        }
コード例 #4
0
        public void Cert_Encoded()
        {
            var httpContext = new DefaultHttpContext();

            httpContext.Connection.ClientCertificate = Certificates.SelfSignedValidWithClientEku;
            var transform = new RequestHeaderClientCertTransform();
            var result    = transform.Apply(httpContext, StringValues.Empty);
            var expected  = Convert.ToBase64String(Certificates.SelfSignedValidWithClientEku.RawData);

            Assert.Equal(expected, result);
        }