Delen via


ClientAuthenticationWithTokenRefresh(String, String, TimeSpan, Int32) Constructor

Definition

Creates an instance of this class.

public ClientAuthenticationWithTokenRefresh (string deviceId, string moduleId = default, TimeSpan suggestedTimeToLive = default, int timeBufferPercentage = 0);
new Microsoft.Azure.Devices.Client.ClientAuthenticationWithTokenRefresh : string * string * TimeSpan * int -> Microsoft.Azure.Devices.Client.ClientAuthenticationWithTokenRefresh
Public Sub New (deviceId As String, Optional moduleId As String = Nothing, Optional suggestedTimeToLive As TimeSpan = Nothing, Optional timeBufferPercentage As Integer = 0)

Parameters

deviceId
String

Device identifier.

moduleId
String

Module identifier.

suggestedTimeToLive
TimeSpan

The suggested time to live value for the generated SAS tokens. The default value is 1 hour.

timeBufferPercentage
Int32

The time buffer before expiry when the token should be renewed, expressed as a percentage of the time to live. The default behavior is that the token will be renewed when it has Microsoft.Azure.Devices.Client.ClientAuthenticationWithTokenRefresh.DefaultSasRenewalBufferPercentage percent or less of its lifespan left.

Exceptions

Thrown when deviceId is null.

Thrown when deviceId or moduleId is empty or whitespace.

Thrown if suggestedTimeToLive is a negative timespan, or if timeBufferPercentage is outside the range 0-100.

Applies to