EventStore / EventStore-Client-Dotnet

Dotnet Client SDK for the Event Store gRPC Client API written in C#
Other
145 stars 38 forks source link

DEV-303 - Client certificate authentication for users #274

Closed shaan1337 closed 5 months ago

shaan1337 commented 10 months ago

Sample code:

    class Program
    {
        static async Task Main(string[] args)
        {
            var certPath = "/path/to/user.crt";
            var certKeyPath = "/path/to/user.key";
            var connectionString = $"esdb://127.0.0.1:2113,127.0.0.2:2113,127.0.0.3:2113?tls=true&tlsVerifyCert=false&certPath={certPath}&certKeyPath={certKeyPath}";

            var settings = EventStoreClientSettings.Create(connectionString);

            using (var client = new EventStoreClient(settings)) {
                await client.SubscribeToStreamAsync(
                    streamName: "test",
                    start: FromStream.Start,
                    eventAppeared: (sub, evt, ct) => {
                        Console.WriteLine(evt.Event.EventStreamId + " " + evt.OriginalEventNumber);
                        return Task.CompletedTask;
                    });

                Console.ReadLine();
            }
        }
    }

Manual tests carried out:

TODO:

linear[bot] commented 10 months ago
DB-498 User x.509 certs POC

POC [DB-283](https://linear.app/eventstore/issue/DB-283/x509-certificate-authentication-for-clients)

w1am commented 5 months ago

I am closing this PR as I started a cleaner version to address the same feature. see #295