共用方式為


X509AuthenticationProvider class

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

SharedAccessSignatureAuthenticationProvider不同于 和 SharedAccessKeyAuthenticationProvider 物件, X509AuthenticationProvider 不會發出 事件, newTokenAvailable 因為 X509 驗證中未涉及任何權杖。 傳輸會使用 getDeviceCredentials 方法取得認證。

屬性

type

方法

fromX509Options(string, string, X509)

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

getDeviceCredentials()
getDeviceCredentials(Callback<TransportConfig>)

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

setX509Options(X509)

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

屬性詳細資料

type

type: AuthenticationType

屬性值

AuthenticationType

方法詳細資料

fromX509Options(string, string, X509)

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

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 憑證和金鑰的物件。