IotHubSasTokenSoftwareAuthenticationProvider Class

public class IotHubSasTokenSoftwareAuthenticationProvider extends IotHubSasTokenAuthenticationProvider

Constructor Summary

Constructor Description
IotHubSasTokenSoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String deviceKey, String sharedAccessToken)

Constructor that takes a connection string containing a sas token or a device key and uses the default token valid seconds and timeBufferPercentage

IotHubSasTokenSoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String deviceKey, String sharedAccessToken, int tokenValidSecs, int timeBufferPercentage)

Constructor that takes a connection string containing a sas token or a device key

IotHubSasTokenSoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String deviceKey, String sharedAccessToken, SSLContext sslContext)

Constructor that takes a connection string containing a sas token or a device key and uses the default token valid seconds and timeBufferPercentage

Method Summary

Modifier and Type Method and Description
boolean canRefreshToken()
char [] getSasToken()

Getter for SasToken. If the saved token has expired, this method shall renew it if possible

boolean isAuthenticationProviderRenewalNecessary()

Returns true if the saved sas token has expired and cannot be auto-renewed through the device key

void setTokenValidSecs(long tokenValidSecs)

Inherited Members

Constructor Details

IotHubSasTokenSoftwareAuthenticationProvider

public IotHubSasTokenSoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String deviceKey, String sharedAccessToken)

Constructor that takes a connection string containing a sas token or a device key and uses the default token valid seconds and timeBufferPercentage

Parameters:

hostname - the IotHub host name
gatewayHostname - The gateway hostname to use, or null if connecting to an IotHub
deviceId - the IotHub device id
moduleId - the module id. May be null if not using a module
deviceKey - the device key for the device. Must be null if the provided sharedAccessToken is not
sharedAccessToken - the sas token string for accessing the device. Must be null if the provided deviceKey is not.

IotHubSasTokenSoftwareAuthenticationProvider

public IotHubSasTokenSoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String deviceKey, String sharedAccessToken, int tokenValidSecs, int timeBufferPercentage)

Constructor that takes a connection string containing a sas token or a device key

Parameters:

hostname - the IotHub host name
gatewayHostname - The gateway hostname to use, or null if connecting to an IotHub
deviceId - the IotHub device id
moduleId - the module id. May be null if not using a module
deviceKey - the device key for the device. Must be null if the provided sharedAccessToken is not
sharedAccessToken - the sas token string for accessing the device. Must be null if the provided deviceKey is not.
tokenValidSecs - the number of seconds that the token will be valid for
timeBufferPercentage - the percent of the sas token's life that will be exhausted before renewal is attempted

IotHubSasTokenSoftwareAuthenticationProvider

public IotHubSasTokenSoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String deviceKey, String sharedAccessToken, SSLContext sslContext)

Constructor that takes a connection string containing a sas token or a device key and uses the default token valid seconds and timeBufferPercentage

Parameters:

hostname - the IotHub host name
gatewayHostname - The gateway hostname to use, or null if connecting to an IotHub
deviceId - the IotHub device id
moduleId - the module id. May be null if not using a module
deviceKey - the device key for the device. Must be null if the provided sharedAccessToken is not
sharedAccessToken - the sas token string for accessing the device. Must be null if the provided deviceKey is not.
sslContext - the sslContext to use for SSL negotiation

Method Details

canRefreshToken

public boolean canRefreshToken()

getSasToken

public char [] getSasToken()

Getter for SasToken. If the saved token has expired, this method shall renew it if possible

Returns:

The value of SasToken

isAuthenticationProviderRenewalNecessary

public boolean isAuthenticationProviderRenewalNecessary()

Returns true if the saved sas token has expired and cannot be auto-renewed through the device key

Returns:

if the sas token needs manual renewal

setTokenValidSecs

public void setTokenValidSecs(long tokenValidSecs)

Parameters:

tokenValidSecs

Applies to