你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
IotHubServiceSasToken Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. auth. IotHubServiceSasToken
- com.
public final class IotHubServiceSasToken
Grants device access to an IoT Hub for the specified amount of time.
Field Summary
Modifier and Type | Field and Description |
---|---|
static final java.lang.String |
TOKEN_FORMAT
The SAS token format. |
protected final long | expiryTimeSeconds |
protected final java.lang.String | keyName |
protected final java.lang.String | keyValue |
protected final java.lang.String | resourceUri |
protected final java.lang.String | token |
protected final long | tokenLifespanSeconds |
Constructor Summary
Constructor | Description |
---|---|
IotHubServiceSasToken(IotHubConnectionString iotHubConnectionString) |
Constructor. |
IotHubServiceSasToken(IotHubConnectionString iotHubConnectionString, long tokenLifespanSeconds) |
Constructor. |
Method Summary
Modifier and Type | Method and Description |
---|---|
final long | getExpiryTimeMillis() |
long | getTokenLifespanSeconds() |
java.lang.String |
toString()
Returns the string representation of the SAS token. |
Methods inherited from java.lang.Object
Field Details
TOKEN_FORMAT
public static final String TOKEN_FORMAT
The SAS token format. The parameters to be interpolated are, in order: the signature the resource URI the expiry time the key name Example: SharedAccessSignature sr=IOTHUBURI&sig=SIGNATURE&se=EXPIRY&skn=SHAREDACCESSKEYNAME
expiryTimeSeconds
protected final long expiryTimeSeconds
keyName
protected final String keyName
keyValue
protected final String keyValue
resourceUri
protected final String resourceUri
token
protected final String token
tokenLifespanSeconds
protected final long tokenLifespanSeconds
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:
IotHubServiceSasToken
public IotHubServiceSasToken(IotHubConnectionString iotHubConnectionString, long tokenLifespanSeconds)
Constructor. Generates a SAS token that grants access to an IoT Hub for the specified amount of time.
Parameters:
Method Details
getExpiryTimeMillis
public final long getExpiryTimeMillis()
Returns:
getTokenLifespanSeconds
public long getTokenLifespanSeconds()
Returns:
toString
public String toString()
Returns the string representation of the SAS token.
Overrides:
IotHubServiceSasToken.toString()Returns: