【问题标题】:Server side authentication in MQTT ServerMQTT 服务器中的服务器端身份验证
【发布时间】:2018-01-17 10:52:18
【问题描述】:

我尝试使用 C# 创建 MQTT 服务器。它在我当地的环境中工作正常。

它工作正常。

我用下面的参数修改了我的代码。

client.ConnectAsync (new MqttClientCredentials (clientId, "UserName", "Password")).Wait ();

我花了几个小时寻找解决方案 - 如何验证客户的真实性。但没有运气。请任何人指导我如何使用clientId,“UserName”,“Password”从服务器端授权每个客户端

等待建议。

提前致谢。

【问题讨论】:

  • 寻求指南或教程对于 Stack Overflow 来说是无关紧要的。您需要尝试,如果您遇到特定问题,请提出问题,但就目前而言,这太宽泛了。它还包含 2 个不同的问题,也不太适合 Stack Overflow 模型。
  • 我花了几个小时寻找解决方案——如何验证客户的真实性。但没有运气。
  • 问题比较好,但你需要向我们展示你在经纪人方面的尝试

标签: c# .net mqtt


【解决方案1】:

来自 MQTTServer 的文档Class

/// <summary>
/// Creates an <see cref="IMqttServer"/> over the TCP protocol, using the 
/// specified MQTT configuration to customize the protocol parameters.
/// </summary>
/// <param name="configuration">
/// The configuration used for creating the Server.
/// See <see cref="MqttConfiguration" /> for more details about the supported values.
/// </param>
/// <param name="authenticationProvider">
/// Optional authentication provider to use, 
/// to enable authentication as part of the connection mechanism.
/// See <see cref="IMqttAuthenticationProvider" /> for more details about how to implement
/// an authentication provider.
/// </param>
/// <returns>A new MQTT Server</returns>

这表示您需要传入IMQTTAuthenticationProvider interface 的实现才能添加身份验证。看来您必须实现自己的身份验证后端,因为该包不提供任何参考实现。

【讨论】:

  • 感谢您的快速回复。
猜你喜欢
  • 2018-02-26
  • 2014-07-10
  • 2020-04-22
  • 2012-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-16
  • 2022-11-30
相关资源
最近更新 更多