Tyler
Tyler

Reputation: 81

Sending a Client Certificate with the RavenDB Client API

My team is developing a .NET web application that will run across several windows servers and we would like to use RavenDB for persistence. We have a requirement from our client that user access to the RavenDB admin page will require the user to present a valid client certificate to be authenticated. We plan to run RavenDB hosted on IIS and configure IIS to require a client certificate for access to the website which require all requests to RavenDB to use a valid client certificate.

Typically in .NET attaching a client certificate to an http request can be done with HttpClient simply by adding an X509Certificate to a WebRequestHandler and passing that to the HTTPClient constructor, and I can see that the Raven.Client DocumentSession code uses HttpClient in its code but I didn't see any way to use the Raven.Client APIto attach a client certificate to my request when creating and using a DocumentStore or DocumentSession to save data to RavenDB.

Are there any good ways to use RavenDB Client API code to send a client certificate to authenticate my request?

Upvotes: 2

Views: 455

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

Yes, you can do that using the ConfigureRequest event, see: https://github.com/ayende/ravendb/blob/v3.5/Raven.Client.WinRT/Connection/HttpJsonRequestFactory.cs#L28

This is accessible from docuemntStore.JsonRequestFactory.ConfigureRequest

Upvotes: 2

Related Questions