您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

SharedAccessSignatureAuthenticationProvider class

Provides an AuthenticationProvider object that can be created simply with a shared access signature and is then used by the device client and transports to authenticate with the Azure IoT hub instance. The SharedAccessSignatureAuthenticationProvider object does not renew the shared access signature token automatically, so the user needs to feed non-expired shared access signature tokens to it using the updateSharedAccessSignature method. For each call to this method, the SharedAccessSignatureAuthenticationProvider will emit a newTokenAvailable event that transports will use to authenticate with the Azure IoT hub instance.

Extends
any

Properties

type

Methods

fromSharedAccessSignature(string)

Creates a new SharedAccessSignatureAuthenticationProvider from a connection string

getDeviceCredentials()

This method is used by the transports to gets the most current device credentials in the form of a TransportConfig object.

getDeviceCredentials(Callback<TransportConfig>)

This method is used by the transports to gets the most current device credentials in the form of a TransportConfig object.

stop()

does nothing and returns - this is part of the token-based authentication provider API but there are no resources to stop/free here.

updateSharedAccessSignature(string)

Updates the shared access signature token that transports should use to authenticate. When called, the SharedAccessSignatureAuthenticationProvider will emit a newTokenAvailable event that the transports can then use to authenticate with the Azure IoT hub instance.

Property Details

type

type: AuthenticationType

Property Value

AuthenticationType

Method Details

fromSharedAccessSignature(string)

Creates a new SharedAccessSignatureAuthenticationProvider from a connection string

static function fromSharedAccessSignature(sharedAccessSignature: string)

Parameters

sharedAccessSignature
string

A shared access signature string containing the required parameters for authentication with the IoT hub.

Returns

getDeviceCredentials()

This method is used by the transports to gets the most current device credentials in the form of a TransportConfig object.

function getDeviceCredentials()

Returns

Promise<TransportConfig>

getDeviceCredentials(Callback<TransportConfig>)

This method is used by the transports to gets the most current device credentials in the form of a TransportConfig object.

function getDeviceCredentials(callback: Callback<TransportConfig>)

Parameters

callback
Callback<TransportConfig>

stop()

does nothing and returns - this is part of the token-based authentication provider API but there are no resources to stop/free here.

function stop()

updateSharedAccessSignature(string)

Updates the shared access signature token that transports should use to authenticate. When called, the SharedAccessSignatureAuthenticationProvider will emit a newTokenAvailable event that the transports can then use to authenticate with the Azure IoT hub instance.

function updateSharedAccessSignature(sharedAccessSignature: string)

Parameters

sharedAccessSignature
string

A shared access signature string containing the required parameters for authentication with the IoT hub.