Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1445

Authentication fails when using App.Config with IAuthenticator

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4.6
    • 2.4.8
    • library
    • None

    Description

      From https://forums.couchbase.com/t/perhaps-a-bug-with-new-couchbase-5-passwordauthenticator/13126

      When I initiate cluster configuration using app.config. In this case, I cannot open a bucket using authenticator. However, if I run almost identical code, where I create new cluster and only set server list for it, everything is working as expected and I can open a bucket with correct credentials.

      How to replicate (code that produces exception):

      Cluster cluster = new Cluster(configurationSectionName: "couchbaseClients/couchbase"); var auth = new Couchbase.Authentication.PasswordAuthenticator(userName, password); cluster.Authenticate(auth); return cluster.OpenBucket(bucketName);

      Exceptions:
      "Could not bootstrap - check inner exceptions for details."
      "One or more errors occurred."

      The same bucket and the same credentials can open a bucket successfully if initialized like this:

      Cluster cluster = new Cluster( new Couchbase.Configuration.Client.ClientConfiguration() { //Servers = _Cluster.Configuration.Servers - it works too, here _Cluster is initialized using app.config Servers = new List<Uri> { new Uri("http://xxx.xxx.xxx.xxxx:8091") } } ); var auth = new Couchbase.Authentication.PasswordAuthenticator(userName, password); cluster.Authenticate(auth);

      App.config related to couchbase is:

      <configSections> <sectionGroup name="couchbaseClients"> <section name="couchbase" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" /> </sectionGroup> </configSections> <couchbaseClients> <couchbase useSsl="false"> <servers> <add uri="http://xxx.xxx.xxx.xxx:8091"></add> </servers> <buckets> <add name="xxxxx" password="*******"> <connectionPool name="custom" maxSize="10" minSize="5" sendTimeout="12000">< /connectionPool> </add> </buckets> </couchbase> </couchbaseClients>

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          I wasn't able to reproduce the problem using the code examples above. I've added tests for both PasswordAuthenticator and ClassicAuthenticator that run successfully against both 4.6.1 and 5.0 clusters.

          mike.goldsmith Michael Goldsmith added a comment - I wasn't able to reproduce the problem using the code examples above. I've added tests for both PasswordAuthenticator and ClassicAuthenticator that run successfully against both 4.6.1 and 5.0 clusters.

          No further details received from forum post and additional tests were added to verify behaviour works as expected.

          mike.goldsmith Michael Goldsmith added a comment - No further details received from forum post and additional tests were added to verify behaviour works as expected.

          People

            mike.goldsmith Michael Goldsmith
            jmorris Jeff Morris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty