我正在将Web API项目从目标框架.net framework 4.6.1
迁移到.net core
。API 需要授权并使用声明集从旧项目中的请求获取或设置声明集合。
在旧项目中,ClaimSet 是从System.IdentityModel
库中使用的,该库不适用于 .net 核心。
我尝试在 .net core 中使用System.Security.Claims
库,但 ClaimSet 属性在此库中不可用。
我的问题,.net core 中是否有可用的ClaimSet
? 如果是,那么我应该如何使用它? 我需要使用哪个库才能在.NET Core 中使用ClaimSet
?
本身没有声明集。您现在只需创建一个Enumerable<Claim>()
,该位于:microsoft.netcore.app\2.2.0\refetcoreapp2.2\System.Security.Claims.dll