Need to use nest with custom webclient to support connection authenticated with X509Certificate

StackOverflow https://stackoverflow.com/questions/21420857

سؤال

I have a derived class of WebClient that overrides WebRequest to return a request object with the certificate needed to talk to our ElasticSearch cluster via proxy. How do I use this with Nest? Thanks.

هل كانت مفيدة؟

المحلول

You can subclass Connection

https://github.com/Mpdreamz/NEST/blob/master/src/Nest/Domain/Connection/Connection.cs

And override

protected override HttpWebRequest CreateWebRequest(string path, string method)
{
       //return your derived WebRequest here.
}

then use this overload on ElasticClient

https://github.com/Mpdreamz/NEST/blob/master/src/Nest/ElasticClient.cs#L29

To use your custom IConnection.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top