public async Task CertificateAndClientIdMissing() { var parser = new X509CertificateSecretParser(); var context = new OwinContext(); context.Request.Body = new MemoryStream(); var secret = await parser.ParseAsync(context.Environment); secret.Should().BeNull(); }
public async Task CertificateMissing() { var parser = new X509CertificateSecretParser(); var context = new OwinContext(); var body = "client_id=client"; context.Request.Body = new MemoryStream(Encoding.UTF8.GetBytes(body)); var secret = await parser.ParseAsync(context.Environment); secret.Should().BeNull(); }
public async Task CertificateAndClientIdPresent() { var parser = new X509CertificateSecretParser(); var context = new OwinContext(); var body = "client_id=client"; context.Request.Body = new MemoryStream(Encoding.UTF8.GetBytes(body)); var cert = TestCert.Load(); context.Set("ssl.ClientCertificate", cert); var secret = await parser.ParseAsync(context.Environment); secret.Type.Should().Be(Constants.ParsedSecretTypes.X509Certificate); secret.Id.Should().Be("client"); secret.Credential.Should().NotBeNull(); secret.Credential.ShouldBeEquivalentTo(cert); }