gpt4 book ai didi

c# - System.IdentityModel.Metadata 和 X509SecurityToken 在 ASP.NET Core 中不可用

转载 作者:太空宇宙 更新时间:2023-11-03 12:30:27 24 4
gpt4 key购买 nike

我目前正在尝试根据 signing key rollover guide 从 Azure Active Directory 获取签名 key 在 Microsoft 文档中,以便对我正在开发的 ASP.NET Core Web API 端点上的 HTTP 请求进行身份验证。

虽然我迁移了文章中显示的源代码,但 ASP.NET Core Web 应用程序中似乎没有一些引用和类可用,例如 System.IdentityModel.Metadata和类似 X509SecurityToken 的类, MetadataSerializer , EntityDescriptorX509RawDataKeyIdentifierClause

Source code with types not found

我已经在 NuGet 上进行了搜索,但似乎没有可用于 System.IdentityModel 的包,而且我也无法在 ASP.NET Core 中引用系统程序集。

我应该在 ASP.NET Core 中使用哪些库?

最佳答案

如果您使用 .NET Core OpenID Connect 或 JwtBearerAuthentication 中间件,则无需在 ASP.Net Core 中手动处理 key 翻转。请检查以下文档:

Web applications / APIs protecting resources using .NET Core OpenID Connect or JwtBearerAuthentication middleware

下面是使用 Azure AD 在 ASP.NET Core Web 应用程序中调用 Web API 的代码示例:

WebApp-WebAPI-OpenIdConnect-DotNet

关于c# - System.IdentityModel.Metadata 和 X509SecurityToken 在 ASP.NET Core 中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43041914/

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