IotHubServiceSasToken Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.auth.IotHubServiceSasToken

public class IotHubServiceSasToken

Grants device access to an IoT Hub for the specified amount of time.

Constructor Summary

Constructor Description
IotHubServiceSasToken(IotHubConnectionString iotHubConnectionString)

Constructor. Generates a SAS token that grants access to an IoT Hub for the default amount of time of 1 hour.

Method Summary

Modifier and Type Method and Description
final long getExpiryTimeMillis()
long getTokenLifespanSeconds()
String toString()

Returns the string representation of the SAS token.

Constructor Details

IotHubServiceSasToken

public IotHubServiceSasToken(IotHubConnectionString iotHubConnectionString)

Constructor. Generates a SAS token that grants access to an IoT Hub for the default amount of time of 1 hour.

Parameters:

iotHubConnectionString - Connection string object containing the connection parameters

Method Details

getExpiryTimeMillis

public final long getExpiryTimeMillis()

Returns:

the number of milliseconds since the UNIX Epoch when this token will expire

getTokenLifespanSeconds

public long getTokenLifespanSeconds()

Returns:

The number of seconds that this token is valid for. Not to be confused with how many seconds the SAS token is still valid for at the time of calling this method.

toString

public String toString()

Returns the string representation of the SAS token.

Returns:

The string representation of the SAS token.

Applies to