【问题标题】:Authentication moving from Couchbase Server 4 to 5身份验证从 Couchbase 服务器 4 移动到 5
【发布时间】:2018-01-24 02:54:13
【问题描述】:

我正在从 Couchbase Server 4.x 迁移到 Couchbase Server 5.x。我知道有一个新的基于用户的身份验证。但我不清楚我应该如何使用ClusterHelper,因为存储桶不再有密码。

以前:

// at app startup
ClusterHelper.Initialize(new ClientDefinition { ... });

// later in DAL
var cluster = ClusterHelper.GetBucket("bucketname", "bucketpassword");

但是现在,使用 5.x,不再有存储桶密码。在哪里输入用户凭据?

【问题讨论】:

    标签: c# .net couchbase


    【解决方案1】:

    ClusterHelper.Initialize 有一个新的重载,带有 IAuthenticator 参数。

    所以现在,例如:

    // at app startup
    ClusterHelper.Initialize(new ClientDefinition { ... }, new PasswordAuthenticator("username", "password"));
    
    // then later in the your data access:
    var cluster = ClusterHelper.GetBucket("bucketname");
    

    ClusterHelper.cs 中的Here's the overload

    如果您之前使用的是 Web.config,您可能还需要更改它。密码不再在 <bucket /> 节点上,它现在在 <couchbase /> 节点上。见this answer in the forums

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-08
      • 2016-05-16
      相关资源
      最近更新 更多