Code Monkey home page Code Monkey logo

Comments (7)

borigas avatar borigas commented on August 23, 2024

Sure. Anything specific?

Here's the official docs on how to configure SSL for the CouchDb server. If you use a certificate that passes the default validation (trusted cert, machine name matches, valid dates, etc), everything should just work over SSL. But if you're cert fails the default validation (self-signed cert like in their instructions, machine name doesn't match, expired, etc), HttpClient won't allow the connection. One way around that is configuring Flurl to do custom certificate validation at the app level as mentioned in #4.

FlurlHttp.ConfigureClient(serverUri.ToString(), c =>
{
    c.Settings.HttpClientFactory = new CertClientFactory();
});

public class CustomCertClientFactory : DefaultHttpClientFactory
{
    public override HttpMessageHandler CreateMessageHandler()
    {
        return new HttpClientHandler()
        {
            ServerCertificateCustomValidationCallback = (message, cert, chain, errors) =>
            {
                // TODO Implement actual cert validation
                return true;
            }
        };
    }
}

from couchdb-net.

matteobortolazzo avatar matteobortolazzo commented on August 23, 2024

So, with this code it will always validate the certificate?
Is it safe?

from couchdb-net.

matteobortolazzo avatar matteobortolazzo commented on August 23, 2024

Sorry stupid question, is up to the user use a valid certificate.
Thank you!

from couchdb-net.

borigas avatar borigas commented on August 23, 2024

Exactly, this code will always accept any cert presented, so it's not safe. As it sits in my above code snippet, the SSL would provide encryption, but not validate that the server is who you expect. It's up to the user to implement cert validation at that TODO to decide whether it will accept the certificate

from couchdb-net.

matteobortolazzo avatar matteobortolazzo commented on August 23, 2024

I'll add a "IgnoreCertificateValidation" and "ConfigureCertificateValidation(func)" so user can decide what to do.

from couchdb-net.

matteobortolazzo avatar matteobortolazzo commented on August 23, 2024

@borigas
The iQueryable should be almost ready for release if you want to test something or if you have any suggestions.

from couchdb-net.

matteobortolazzo avatar matteobortolazzo commented on August 23, 2024
var client = new CouchClient(
    "http://localhost:5984", s => s
        .ConfigureCookieAuthentication("root", "relax")
        .IgnoreCertificateValidation()
   );

from couchdb-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.