你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CommunicationIdentityClient class

用于与 Azure 通信服务用户令牌管理交互的客户端类。

构造函数

CommunicationIdentityClient(string, CommunicationIdentityOptions)

初始化 CommunicationIdentity 类的新实例。

CommunicationIdentityClient(string, KeyCredential, CommunicationIdentityOptions)

使用 Azure KeyCredential 初始化 CommunicationIdentity 类的新实例。

CommunicationIdentityClient(string, TokenCredential, CommunicationIdentityOptions)

使用 TokenCredential 初始化 CommunicationIdentity 类的新实例。

方法

createUser(OperationOptions)

创建单个用户。

deleteUser(CommunicationUserIdentifier, OperationOptions)

触发用户的吊销事件并删除其所有数据。

issueToken(CommunicationUserIdentifier, TokenScope[], OperationOptions)

创建限定范围的用户令牌。

revokeTokens(CommunicationUserIdentifier, Date, OperationOptions)

撤销为用户创建的所有数据和令牌。

构造函数详细信息

CommunicationIdentityClient(string, CommunicationIdentityOptions)

初始化 CommunicationIdentity 类的新实例。

new CommunicationIdentityClient(connectionString: string, options?: CommunicationIdentityOptions)

参数

connectionString

string

用于连接到 Azure 通信服务资源的连接字符串。 示例:“endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret“;

options
CommunicationIdentityOptions

可选。 用于配置 HTTP 管道的选项。

CommunicationIdentityClient(string, KeyCredential, CommunicationIdentityOptions)

使用 Azure KeyCredential 初始化 CommunicationIdentity 类的新实例。

new CommunicationIdentityClient(url: string, credential: KeyCredential, options?: CommunicationIdentityOptions)

参数

url

string

服务的终结点(例如:https://contoso.eastus.communications.azure.net)。

credential
KeyCredential

用于对服务的请求进行身份验证的对象。 使用 AzureKeyCredential 或 @azure/identity 创建凭据。

options
CommunicationIdentityOptions

可选。 用于配置 HTTP 管道的选项。

CommunicationIdentityClient(string, TokenCredential, CommunicationIdentityOptions)

使用 TokenCredential 初始化 CommunicationIdentity 类的新实例。

new CommunicationIdentityClient(url: string, credential: TokenCredential, options?: CommunicationIdentityOptions)

参数

url

string

服务的终结点(例如:https://contoso.eastus.communications.azure.net

credential
TokenCredential

用于对服务的请求进行身份验证的 TokenCredential。

options
CommunicationIdentityOptions

可选。 用于配置 HTTP 管道的选项。

方法详细信息

createUser(OperationOptions)

创建单个用户。

function createUser(options?: OperationOptions): Promise<CreateUserResponse>

参数

options
OperationOptions

请求的其他选项。

返回

deleteUser(CommunicationUserIdentifier, OperationOptions)

触发用户的吊销事件并删除其所有数据。

function deleteUser(user: CommunicationUserIdentifier, options?: OperationOptions): Promise<{ _response: HttpResponse }>

参数

user
CommunicationUserIdentifier

正在删除的用户。

options
OperationOptions

请求的其他选项。

返回

Promise<{ _response: HttpResponse }>

issueToken(CommunicationUserIdentifier, TokenScope[], OperationOptions)

创建限定范围的用户令牌。

function issueToken(user: CommunicationUserIdentifier, scopes: TokenScope[], options?: OperationOptions): Promise<IssueTokenResponse>

参数

user
CommunicationUserIdentifier

要吊销其令牌的用户。

scopes

TokenScope[]

要包含在令牌中的作用域。

options
OperationOptions

请求的其他选项。

返回

revokeTokens(CommunicationUserIdentifier, Date, OperationOptions)

撤销为用户创建的所有数据和令牌。

function revokeTokens(user: CommunicationUserIdentifier, tokensValidFrom?: Date, options?: OperationOptions): Promise<{ _response: HttpResponse }>

参数

user
CommunicationUserIdentifier

要吊销其令牌的用户。

tokensValidFrom

Date

在此时间之前颁发的令牌将被撤销。

options
OperationOptions

请求的其他选项。

返回

Promise<{ _response: HttpResponse }>