我目前正在尝试根据 signing key rollover guide 从 Azure Active Directory 获取签名 key 在 Microsoft 文档中,以便对我正在开发的 ASP.NET Core Web API 端点上的 HTTP 请求进行身份验证。
虽然我迁移了文章中显示的源代码,但 ASP.NET Core Web 应用程序中似乎没有一些引用和类可用,例如 System.IdentityModel.Metadata
和类似 X509SecurityToken
的类, MetadataSerializer
, EntityDescriptor
和X509RawDataKeyIdentifierClause
。
Source code with types not found
我已经在 NuGet 上进行了搜索,但似乎没有可用于 System.IdentityModel 的包,而且我也无法在 ASP.NET Core 中引用系统程序集。
我应该在 ASP.NET Core 中使用哪些库?
最佳答案
如果您使用 .NET Core OpenID Connect 或 JwtBearerAuthentication 中间件,则无需在 ASP.Net Core 中手动处理 key 翻转。请检查以下文档:
下面是使用 Azure AD 在 ASP.NET Core Web 应用程序中调用 Web API 的代码示例:
关于c# - System.IdentityModel.Metadata 和 X509SecurityToken 在 ASP.NET Core 中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43041914/