public class IotHubSasTokenHsmAuthenticationProvider extends IotHubSasTokenWithRefreshAuthenticationProvider
ENCODING_FORMAT_NAME, MILLISECONDS_PER_SECOND, MINIMUM_EXPIRATION_TIME_OFFSET, sasToken, timeBufferPercentage, tokenValidSecs
deviceId, gatewayHostname, hostname, iotHubSSLContext, iotHubTrustedCert, moduleId, pathToIotHubTrustedCert, sslContextNeedsUpdate
Modifier and Type | Method and Description |
---|---|
boolean |
canRefreshToken()
Returns true as the Hsm can always refresh the token
|
static IotHubSasTokenHsmAuthenticationProvider |
create(SignatureProvider signatureProvider,
String deviceId,
String moduleId,
String hostname,
String gatewayHostname,
String generationId,
int suggestedTimeToLiveSeconds,
int timeBufferPercentage)
Constructor for a IotHubSasTokenHsmAuthenticationProvider instance
|
void |
refreshSasToken()
Renew the saved sas token using the HSM unit
|
buildAudience, getSasToken, isAuthenticationProviderRenewalNecessary
getMillisecondsBeforeProactiveRenewal, getTokenValidSecs, setTokenValidSecs, shouldRefreshToken
getDeviceId, getGatewayHostname, getHostname, getIotHubTrustedCert, getModuleId, getPathToIotHubTrustedCert, getSSLContext, setIotHubTrustedCert, setPathToIotHubTrustedCert, setSSLContext
public static IotHubSasTokenHsmAuthenticationProvider create(SignatureProvider signatureProvider, String deviceId, String moduleId, String hostname, String gatewayHostname, String generationId, int suggestedTimeToLiveSeconds, int timeBufferPercentage) throws IOException, TransportException
signatureProvider
- the signature provider to be used when generating sas tokensdeviceId
- the id of the device the module belongs tomoduleId
- the id of the module to be authenticated forhostname
- the hostname of the iothub to be authenticated for. May be null if gatewayHostname is notgatewayHostname
- the gatewayHostname of the edge hub to be authenticated for. May be null if hostname is notgenerationId
- the generation idsuggestedTimeToLiveSeconds
- the time for the generated sas tokens to live fortimeBufferPercentage
- the percent of the life a sas token will live before attempting to be renewed. (100 means don't renew until end of life)IOException
- If the Hsm unit cannot be reachedTransportException
- If the Hsm unit cannot be reachedpublic void refreshSasToken() throws IOException, TransportException
refreshSasToken
in class IotHubSasTokenWithRefreshAuthenticationProvider
IOException
- If the Hsm unit cannot be reachedTransportException
- If the Hsm unit cannot be reachedpublic boolean canRefreshToken()
canRefreshToken
in class IotHubSasTokenAuthenticationProvider
Copyright © 2020. All rights reserved.