public final class IotHubSasToken
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
IotHubSasToken() |
|
IotHubSasToken(java.lang.String hostname,
java.lang.String deviceId,
java.lang.String deviceKey,
java.lang.String sharedAccessToken,
java.lang.String moduleId,
long expiryTime)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
buildSharedAccessToken(java.lang.String audience,
java.lang.String signature,
long expiry)
Creates a shared access token from the provided audience, signature and expiry time
|
java.lang.String |
getSasToken() |
static boolean |
isExpired(java.lang.String sasToken)
Returns if the provided sasToken has expired yet or not
|
java.lang.String |
toString()
Returns the string representation of the SAS token.
|
public IotHubSasToken(java.lang.String hostname,
java.lang.String deviceId,
java.lang.String deviceKey,
java.lang.String sharedAccessToken,
java.lang.String moduleId,
long expiryTime)
hostname - the hostname of the hub the token is fordeviceId - The id of the device the token is fordeviceKey - The device key for connecting the device to the hub with. May be null if sharedAccessToken is not.sharedAccessToken - The sas token for connecting the device to the hub with. May be null if deviceKey is not.moduleId - the module id. May be null if the sas token is not for a moduleexpiryTime - the time, as a UNIX timestamp, after which the token will become invalidprotected IotHubSasToken()
public static java.lang.String buildSharedAccessToken(java.lang.String audience,
java.lang.String signature,
long expiry)
audience - the audience of the tokensignature - the signature of the tokenexpiry - when the token will expire, in seconds since the epochpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getSasToken()
public static boolean isExpired(java.lang.String sasToken)
sasToken - the token to check for expirationCopyright © 2023. All rights reserved.