public abstract class IotHubSasTokenWithRefreshAuthenticationProvider extends IotHubSasTokenAuthenticationProvider
sasToken, tokenValidSecsdeviceId, gatewayHostname, hostname, moduleId| Modifier | Constructor and Description |
|---|---|
protected |
IotHubSasTokenWithRefreshAuthenticationProvider(java.lang.String hostname,
java.lang.String gatewayHostName,
java.lang.String deviceId,
java.lang.String moduleId,
java.lang.String sharedAccessToken,
int suggestedTimeToLiveSeconds,
int timeBufferPercentage)
Constructor for IotHubSasTokenWithRefreshAuthenticationProvider
|
protected |
IotHubSasTokenWithRefreshAuthenticationProvider(java.lang.String hostname,
java.lang.String gatewayHostName,
java.lang.String deviceId,
java.lang.String moduleId,
java.lang.String sharedAccessToken,
int suggestedTimeToLiveSeconds,
int timeBufferPercentage,
javax.net.ssl.SSLContext sslContext)
Constructor for IotHubSasTokenWithRefreshAuthenticationProvider
|
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
buildAudience(java.lang.String hostname,
java.lang.String deviceId,
java.lang.String moduleId)
Constructs the audience string to be used in a sas token
|
char[] |
getSasToken()
Check if sas token should be renewed at all, and then renew it if necessary
|
boolean |
isAuthenticationProviderRenewalNecessary()
Returns false as instances of this class will always be able to renew their own sas token
|
abstract void |
refreshSasToken()
Renew the saved sas token
|
canRefreshToken, getMillisecondsBeforeProactiveRenewal, getTokenValidSecs, isSasTokenExpired, setTokenValidSecs, shouldRefreshTokengetDeviceId, getGatewayHostname, getHostname, getModuleId, getSSLContextprotected IotHubSasTokenWithRefreshAuthenticationProvider(java.lang.String hostname,
java.lang.String gatewayHostName,
java.lang.String deviceId,
java.lang.String moduleId,
java.lang.String sharedAccessToken,
int suggestedTimeToLiveSeconds,
int timeBufferPercentage)
hostname - the hostnamegatewayHostName - the gateway hostnamedeviceId - the device idmoduleId - the module idsharedAccessToken - the shared access tokensuggestedTimeToLiveSeconds - the time to live for generated tokenstimeBufferPercentage - the percent of a sas token's life to live before renewingprotected IotHubSasTokenWithRefreshAuthenticationProvider(java.lang.String hostname,
java.lang.String gatewayHostName,
java.lang.String deviceId,
java.lang.String moduleId,
java.lang.String sharedAccessToken,
int suggestedTimeToLiveSeconds,
int timeBufferPercentage,
javax.net.ssl.SSLContext sslContext)
hostname - the hostnamegatewayHostName - the gateway hostnamedeviceId - the device idmoduleId - the module idsharedAccessToken - the shared access tokensuggestedTimeToLiveSeconds - the time to live for generated tokenstimeBufferPercentage - the percent of a sas token's life to live before renewingsslContext - the SSLContext the connection will useprotected static java.lang.String buildAudience(java.lang.String hostname,
java.lang.String deviceId,
java.lang.String moduleId)
throws java.io.UnsupportedEncodingException
hostname - the hostnamedeviceId - the device idmoduleId - the module idjava.io.UnsupportedEncodingException - if UTF-8 encoding is not supportedpublic boolean isAuthenticationProviderRenewalNecessary()
isAuthenticationProviderRenewalNecessary in class IotHubSasTokenAuthenticationProviderpublic abstract void refreshSasToken()
throws java.io.IOException,
TransportException
java.io.IOException - If an IOException is encountered while refreshing the sas tokenTransportException - If a TransportException is encountered while refreshing the sas tokenpublic char[] getSasToken()
throws java.io.IOException,
TransportException
getSasToken in class IotHubSasTokenAuthenticationProviderjava.io.IOException - If an IOException is encountered while refreshing the sas tokenTransportException - If a TransportException is encountered while refreshing the sas tokenCopyright © 2023. All rights reserved.