mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
Password Provider for dynamic password
This commit is contained in:
@@ -10,5 +10,7 @@ namespace MQTTnet.Core.ManagedClient
|
||||
TimeSpan AutoReconnectDelay { get; }
|
||||
|
||||
IManagedMqttClientStorage Storage { get; }
|
||||
|
||||
Func<IManagedMqttClientOptions, string> PasswordProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -277,6 +277,7 @@ namespace MQTTnet.Core.ManagedClient
|
||||
|
||||
try
|
||||
{
|
||||
_options.PasswordProvider?.Invoke(_options);
|
||||
await _mqttClient.ConnectAsync(_options.ClientOptions).ConfigureAwait(false);
|
||||
return ReconnectionResult.Reconnected;
|
||||
}
|
||||
|
||||
@@ -10,5 +10,8 @@ namespace MQTTnet.Core.ManagedClient
|
||||
public TimeSpan AutoReconnectDelay { get; set; } = TimeSpan.FromSeconds(5);
|
||||
|
||||
public IManagedMqttClientStorage Storage { get; set; }
|
||||
|
||||
public Func<IManagedMqttClientOptions, string> PasswordProvider { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user