|
@@ -26,24 +26,24 @@ namespace HiTeachCE.Extension.Mqtt
|
|
builder.WithConnectionValidator(c =>
|
|
builder.WithConnectionValidator(c =>
|
|
{
|
|
{
|
|
|
|
|
|
- MQTTInfo info= RedisHelper.HGet<MQTTInfo>("mqtt:"+c.ClientId, c.ClientId);
|
|
|
|
- if (info != null)
|
|
|
|
- {
|
|
|
|
- if (c.Username != info.username)
|
|
|
|
- {
|
|
|
|
- c.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (!BCrypt.Net.BCrypt.Verify(c.Password,info.password))
|
|
|
|
- {
|
|
|
|
- c.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- c.ReasonCode = MqttConnectReasonCode.ClientIdentifierNotValid;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ //MQTTInfo info= RedisHelper.HGet<MQTTInfo>("mqtt:"+c.ClientId, c.ClientId);
|
|
|
|
+ //if (info != null)
|
|
|
|
+ //{
|
|
|
|
+ // if (c.Username != info.username)
|
|
|
|
+ // {
|
|
|
|
+ // c.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ // if (!BCrypt.Net.BCrypt.Verify(c.Password,info.password))
|
|
|
|
+ // {
|
|
|
|
+ // c.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ //else {
|
|
|
|
+ // c.ReasonCode = MqttConnectReasonCode.ClientIdentifierNotValid;
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
c.ReasonCode = MqttConnectReasonCode.Success;
|
|
c.ReasonCode = MqttConnectReasonCode.Success;
|
|
|
|
|
|
})
|
|
})
|