共用方式為


X509AuthenticationProvider class

提供 AuthenticationProvider 物件,只要使用 X509 憑證和金鑰即可建立,然後由裝置用戶端和傳輸用來向 Azure IoT 中樞實例進行驗證。

不同於 SharedAccessSignatureAuthenticationProviderSharedAccessKeyAuthenticationProvider 物件,X509AuthenticationProvider 不會發出 newTokenAvailable 事件,因為 X509 驗證中沒有涉及令牌。 傳輸會使用 getDeviceCredentials 方法來取得認證。

屬性

type

方法

fromX509Options(string, string, X509)

從包含憑證和金鑰的 X509AuthenticationProvider 物件建立新的 X509

getDeviceCredentials()
getDeviceCredentials(Callback<TransportConfig>)

傳輸會使用此方法,以 TransportConfig 物件的形式取得最新的裝置認證。

setX509Options(X509)

更新裝置用來連線及驗證 Azure IoT 中樞實例的憑證和密鑰。

屬性詳細資料

type

type: AuthenticationType

屬性值

AuthenticationType

方法詳細資料

fromX509Options(string, string, X509)

從包含憑證和金鑰的 X509AuthenticationProvider 物件建立新的 X509

static function fromX509Options(deviceId: string, iotHubHostname: string, x509info: X509): X509AuthenticationProvider

參數

deviceId

string

裝置標識碼。

iotHubHostname

string

裝置應該連線的 Azure IoT 中樞實例主機名。

x509info

X509

X509 物件,其中包含裝置可用來向 Azure IoT 中樞實例進行驗證的憑證和密鑰。

傳回

getDeviceCredentials()

function getDeviceCredentials(): Promise<TransportConfig>

傳回

Promise<TransportConfig>

getDeviceCredentials(Callback<TransportConfig>)

傳輸會使用此方法,以 TransportConfig 物件的形式取得最新的裝置認證。

function getDeviceCredentials(callback?: Callback<TransportConfig>)

參數

callback

Callback<TransportConfig>

會使用錯誤或一組可用來向IoT中樞進行驗證的裝置認證來呼叫的選擇性函式。

setX509Options(X509)

更新裝置用來連線及驗證 Azure IoT 中樞實例的憑證和密鑰。

function setX509Options(x509: X509)

參數

x509

X509

包含憑證和金鑰的 X509 物件。