IotHubSasTokenProvidedAuthenticationProvider Class

public class IotHubSasTokenProvidedAuthenticationProvider
extends IotHubSasTokenAuthenticationProvider

IotHubSasTokenAuthenticationProvider implementation where the tokens are provided by an instance of SasTokenProvider. This is used in cases like when the user creates a device client with com.microsoft.azure.sdk.iot.device.DeviceClient#DeviceClient(String, String, SasTokenProvider, IotHubClientProtocol, ClientOptions)

Constructor Summary

Constructor Description
IotHubSasTokenProvidedAuthenticationProvider(String hostName, String deviceId, String moduleId, SasTokenProvider sasTokenProvider, SSLContext sslContext)

Method Summary

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

Returns true if the this authentication provider is no longer valid.

void setTokenValidSecs(long tokenValidSecs)

Methods inherited from IotHubAuthenticationProvider

Methods inherited from IotHubSasTokenAuthenticationProvider

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

IotHubSasTokenProvidedAuthenticationProvider

public IotHubSasTokenProvidedAuthenticationProvider(String hostName, String deviceId, String moduleId, SasTokenProvider sasTokenProvider, SSLContext sslContext)

Parameters:

hostName
deviceId
moduleId
sasTokenProvider
sslContext

Method Details

canRefreshToken

public boolean canRefreshToken()

Overrides:

IotHubSasTokenProvidedAuthenticationProvider.canRefreshToken()

getMillisecondsBeforeProactiveRenewal

public int getMillisecondsBeforeProactiveRenewal()

Overrides:

IotHubSasTokenProvidedAuthenticationProvider.getMillisecondsBeforeProactiveRenewal()

getSasToken

public char[] getSasToken()

Overrides:

IotHubSasTokenProvidedAuthenticationProvider.getSasToken()

isAuthenticationProviderRenewalNecessary

public boolean isAuthenticationProviderRenewalNecessary()

Returns true if the this authentication provider is no longer valid. If true, users will need to create a new DeviceClient instance to get a new authentication provider. The most common case for this is if the user provides a SAS token, but no symmetric key, and that SAS token has expired. At that point, the user's client won't be able to authenticate anymore.

Overrides:

IotHubSasTokenProvidedAuthenticationProvider.isAuthenticationProviderRenewalNecessary()

setTokenValidSecs

public void setTokenValidSecs(long tokenValidSecs)

Overrides:

IotHubSasTokenProvidedAuthenticationProvider.setTokenValidSecs(long tokenValidSecs)

Parameters:

tokenValidSecs

Applies to