共用方式為


AppCredentials class

一般 AppCredentials 驗證實作和快取。 支援任何 ADAL 用戶端認證流程。 子類別可以實作 refreshToken 以取得令牌。

建構函式

AppCredentials(string, string, string)

初始化 AppCredentials 類別的新實例。

屬性

appId
oAuthEndpoint

取得要使用的 OAuth 端點。 設定要使用的 OAuth 端點。

oAuthScope

取得要使用的 OAuth 範圍。 設定要使用的 OAuth 範圍。

tokenCacheKey

方法

getToken(boolean)

取得 OAuth 存取令牌。

isTrustedServiceUrl(string)

檢查服務 URL 是否為受信任的主機。

signRequest(WebResource)

將認證套用至 HTTP 要求。

trustServiceUrl(string, Date)

將服務 URL 的主機新增至信任的主機。 如果未提供到期時間,到期日將是目前 (utc) 日期 + 1 天。

建構函式詳細資料

AppCredentials(string, string, string)

初始化 AppCredentials 類別的新實例。

new AppCredentials(appId: string, channelAuthTenant?: string, oAuthScope?: string)

參數

appId

string

應用程式識別碼。

channelAuthTenant

string

自選。 oauth 令牌租使用者。

oAuthScope

string

令牌的範圍。

屬性詳細資料

appId

appId: string

屬性值

string

oAuthEndpoint

取得要使用的 OAuth 端點。 設定要使用的 OAuth 端點。

string oAuthEndpoint

屬性值

string

要使用的 OAuthEndpoint。

oAuthScope

取得要使用的 OAuth 範圍。 設定要使用的 OAuth 範圍。

string oAuthScope

屬性值

string

要使用的 OAuth 範圍。

tokenCacheKey

tokenCacheKey: string

屬性值

string

方法詳細資料

getToken(boolean)

取得 OAuth 存取令牌。

function getToken(forceRefresh?: boolean): Promise<string>

參數

forceRefresh

boolean

True 是表示 強制重新整理令牌;如果存在快取令牌,則為 false。

傳回

Promise<string>

Promise,表示要執行的工作佇列。

備註

如果承諾成功,結果會包含存取令牌字串。

isTrustedServiceUrl(string)

警告

此 API 現已淘汰。

檢查服務 URL 是否為受信任的主機。

static function isTrustedServiceUrl(serviceUrl: string): boolean

參數

serviceUrl

string

服務 URL

傳回

boolean

如果信任服務 URL 的主機,則為 True;否則為 False。

signRequest(WebResource)

將認證套用至 HTTP 要求。

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

參數

webResource

WebResource

WebResource HTTP 要求。

傳回

Promise<WebResource>

代表異步操作的 Promise。

trustServiceUrl(string, Date)

警告

此 API 現已淘汰。

將服務 URL 的主機新增至信任的主機。 如果未提供到期時間,到期日將是目前 (utc) 日期 + 1 天。

static function trustServiceUrl(serviceUrl: string, expiration?: Date)

參數

serviceUrl

string

服務 URL

expiration

Date