共用方式為


MSIAppServiceTokenCredentials class

提供 App Service 環境中受控服務識別令牌認證的相關信息。

Extends

建構函式

MSIAppServiceTokenCredentials(MSIAppServiceOptions)

建立 MSIAppServiceTokenCredentials 的實例。

屬性

clientId

您想要令牌之受控識別的 clientId。 如果您的 App Service 具有使用者指派的受控識別,則為必要。

msiApiVersion

本機 MSI 代理程式的 API 版本。 預設值為 “2017-09-01”。

msiEndpoint

應用程式可從中要求令牌的本機 URL。 除非指定這個屬性,否則兩個環境變數中的任何一個 IDENTITY_ENDPOINTMSI_ENDPOINT 都會當做預設值使用。

msiSecret

程式代碼與本機 MSI 代理程式之間通訊所使用的秘密。 除非指定這個屬性,否則兩個環境變數中的任何一個 IDENTITY_SECRETMSI_SECRET 都會當做預設值使用。

繼承的屬性

resource

Azure 資源端點。

  • 默認為來自環境的 Azure Resource Manager:AzureCloud。 “https://management.azure.com/"
  • 針對 ServiceManagement (ASM):“https://management.core.windows.net/"
  • 針對 Azure KeyVault:“https://vault.azure.net"
  • 針對 Azure Batch:“https://batch.core.windows.net"
  • 針對 Azure Active Directory Graph:“https://graph.windows.net"

方法

getToken()

準備並將 GET 要求傳送至應用程式服務所指示的服務端點,此端點會以存取令牌回應。

繼承的方法

parseTokenResponse(string)

將 tokenResponse json 字串剖析為 物件,並將第一層的屬性轉換為 camelCase。 此方法會嘗試標準化 tokenResponse

signRequest(WebResource)

使用驗證標頭簽署要求。

建構函式詳細資料

MSIAppServiceTokenCredentials(MSIAppServiceOptions)

建立 MSIAppServiceTokenCredentials 的實例。

new MSIAppServiceTokenCredentials(options?: MSIAppServiceOptions)

參數

屬性詳細資料

clientId

您想要令牌之受控識別的 clientId。 如果您的 App Service 具有使用者指派的受控識別,則為必要。

clientId?: string

屬性值

string

msiApiVersion

本機 MSI 代理程式的 API 版本。 預設值為 “2017-09-01”。

msiApiVersion?: string

屬性值

string

msiEndpoint

應用程式可從中要求令牌的本機 URL。 除非指定這個屬性,否則兩個環境變數中的任何一個 IDENTITY_ENDPOINTMSI_ENDPOINT 都會當做預設值使用。

msiEndpoint: string

屬性值

string

msiSecret

程式代碼與本機 MSI 代理程式之間通訊所使用的秘密。 除非指定這個屬性,否則兩個環境變數中的任何一個 IDENTITY_SECRETMSI_SECRET 都會當做預設值使用。

msiSecret: string

屬性值

string

繼承的屬性詳細資料

resource

Azure 資源端點。

  • 默認為來自環境的 Azure Resource Manager:AzureCloud。 “https://management.azure.com/"
  • 針對 ServiceManagement (ASM):“https://management.core.windows.net/"
  • 針對 Azure KeyVault:“https://vault.azure.net"
  • 針對 Azure Batch:“https://batch.core.windows.net"
  • 針對 Azure Active Directory Graph:“https://graph.windows.net"
resource: string

屬性值

string

繼承自MSITokenCredentials.resource

方法詳細資料

getToken()

準備並將 GET 要求傳送至應用程式服務所指示的服務端點,此端點會以存取令牌回應。

function getToken(): Promise<MSITokenResponse>

傳回

Promise<MSITokenResponse>

具有 tokenResponse 的 Promise(tokenType 和 accessToken 是兩個重要屬性)。

繼承的方法的詳細資料

parseTokenResponse(string)

將 tokenResponse json 字串剖析為 物件,並將第一層的屬性轉換為 camelCase。 此方法會嘗試標準化 tokenResponse

function parseTokenResponse(body: string): TokenResponse

參數

body

string

json 字串

傳回

TokenResponse

tokenResponse (tokenType 和 accessToken 是兩個重要屬性)。

繼承自MSITokenCredentials.parseTokenResponse

signRequest(WebResource)

使用驗證標頭簽署要求。

function signRequest(webResource: WebResource): Promise<WebResource>

參數

webResource
WebResource

要簽署的 WebResource。

傳回

Promise<WebResource>

具有已簽署 WebResource 的承諾。

繼承自MSITokenCredentials.signRequest