gpt4 book ai didi

azure - 适用于中国特定 azure 云的 Adal 库

转载 作者:行者123 更新时间:2023-12-03 01:49:07 25 4
gpt4 key购买 nike

我正在开发一个单页应用程序,该应用程序使用 adal.js 通过 AAD 进行身份验证。现在我们也计划将此应用程序部署在中国特定的Azure云中。

令我困惑的是 adal.js 文件第 112 行的硬编码(可能是我的同事完成的)链接,如下所示。

   if (AuthenticationContext.prototype._singletonInstance) {
return AuthenticationContext.prototype._singletonInstance;
}
AuthenticationContext.prototype._singletonInstance = this;

// public
this.instance = 'https://login.windows.net/';
this.config = {};
this.callback = null;
this.popUp = false;

// private
this._user = null;
this._renewActive = false;
this._loginInProgress = false;
this._renewStates = [];

This address 'https://login.windows.net/' isn't valid for azure china cloud.

那么我是否需要在代码中更改此值,或者我们有任何新版本的 ADAl,无需更改此登录地址。

提前致谢。

最佳答案

正如@GauravMantri所说,全局Azure和中国Azure之间使用Azure AD的区别只是使用不同的端点,请参见下图,该图是从中国Azure门户截图的。

enter image description here

作为引用,以下是 China Azure AD 所需的一些变量(C# 语言)。

private static string clientId = "xxxxxxx-xxxxx-xxxx-xxxx-xxxxxx";
private static string appKey = "xxxxxxxxxxxxxxxxxxxxxxxx=";
private static string graphResourceId = "https://graph.chinacloudapi.cn";
private static string domainName = "xxxxxxxxxxxxxx.partner.onmschina.cn";
private static string tenantID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx";

对于使用adal.js,您可以尝试在源代码中搜索,并将这些用于全局的端点替换为用于中国Azure的端点。或者我认为您可以尝试引用全局Azure AD REST API与中国Azure端点来验证差异是否仅在端点内,并在您的代码中使用REST API。

同时,有一份文档列出了全局和中国的端点映射,请移步url https://www.azure.cn/documentation/articles/developerdifferences/#bookmark-7 (右侧栏的部分名称为中国区 Azure 资源端点URI(供应用程序代码使用))如果您可以用中文阅读。

我对下图进行了有关 Azure AD 的快照。 enter image description here

希望有帮助。如有任何疑问,请随时告诉我。

关于azure - 适用于中国特定 azure 云的 Adal 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41713427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com