c# - 使用集成 Windows 身份验证时出现 MSAL 4.16.0 问题

标签 c# azure azure-active-directory azure-ad-msal kerberos-delegation

我正在编写一个 dotnet core 控制台应用程序,它利用 MSAL 库生成访问 token 。我正在使用集成 Windows 身份验证作为 this 中提到的所有约束。我所在的组织对链接感到满意。这似乎适用于 MSAL 4.15.0 库版本。但一旦我开始使用 MSAL 4.16.0 版本,我最终会收到以下异常。

Inner Excception: MSAL.NetCore.4.16.0.0.MsalServiceException:
        ErrorCode: federated_service_returned_error
Microsoft.Identity.Client.MsalServiceException: Federated service at <URL> returned error:
   at Microsoft.Identity.Client.WsTrust.WsTrustWebRequestManager.GetWsTrustResponseAsync(WsTrustEndpoint wsTrustEndpoint, String wsTrustRequest, RequestContext requestContext)
   at Microsoft.Identity.Client.WsTrust.CommonNonInteractiveHandler.GetWsTrustResponseAsync(UserAuthType userAuthType, String cloudAudienceUrn, WsTrustEndpoint endpoint, String username, SecureString securePassword)
        StatusCode: 401
        ResponseBody:
        Headers: Date: Mon, 10 Aug 2020 20:24:54 GMT
Cache-Control: no-cache, no-store
Pragma: no-cache
WWW-Authenticate: Negotiate
Set-Cookie: PF=QSEPNWjNTF0s1lakkLKluT;Path=/;Secure;HttpOnly;SameSite=None
Transfer-Encoding: chunked
<---

这是我编写的简单代码:

            app = PublicClientApplicationBuilder.Create(clientId).WithTenantId(tenant).WithAuthority(authority).Build();
            try
            {
                Task<AuthenticationResult> result = app.AcquireTokenByIntegratedWindowsAuth(scopes).WithUsername(username).ExecuteAsync();
                Console.Write(result.Result.AccessToken);
                Console.ReadLine();
            }

为了进一步澄清,这工作正常,直到 MSAL 4.15.0 。它从版本MSAL 4.16.0开始失败及以上。

有什么想法吗?

最佳答案

对于遇到此问题的人来说,这是一个已知错误,正在调查中。查看Github

关于c# - 使用集成 Windows 身份验证时出现 MSAL 4.16.0 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63386019/

相关文章:

azure - 如何对具有不同描述和显示名称的 AppRoles 和 oauth2Permissions 使用相同的值?

c# - DataGrid Width 在 Windows Mobile 中没有影响。 C#

C# 属性限制

c# - 如何在 asp.net 中使用 chekboxchanged 之前的确认?

Azure 授权 : what is scope parameter in REST API?

azure-active-directory - 我可以使用 Microsoft Graph API 在 MS Teams 上所属的所有团队/组中搜索文件吗

c# - KB4344167 安全更新破坏了 TLS 代码

ASP.Net MVC3 Azure - 我需要成员(member)提供程序存储过程吗?

mysql - Azure - Gac 组件

django - 无法让 sql server 与 django azure web 应用程序一起使用