使用 Windows AD 身份验证连接到 ElasticSearch NEST 库

时间:2021-06-16 06:02:04

标签: asp.net elasticsearch nest

我正在尝试使用 ElasticSearch NEST .net 客户端通过应用程序池帐户的身份连接到弹性搜索。即没有基本身份验证或 API 密钥。我无法找到一种方法来完成它。通常,在处理.Net HttpClient 时,我可以将其设置为使用 DefaultCredentials,它将使用 Windows Auth 传递当前用户的 Windows 身份,在 IIS 场景中,将是应用程序池身份。但这对于 NEST ConnectionSettings 是不可能的

下面的代码是我如何构建 ConnectionSettings 和两个注释掉的我不想使用的身份验证选项

var settings = new ConnectionSettings(new Uri(url))
    .DefaultIndex(defaultIndex)
    //.BasicAuthentication(username, password)
    //.ApiKeyAuthentication(new ApiKeyAuthenticationCredentials(key))
    .EnableDebugMode();

var client = new ElasticClient(settings);

以前有人成功过吗?

非常感谢您的帮助。

0 个答案:

没有答案
相关问题