希望很容易解决.
微软的System.IdentityModels.Tokens.Jwt软件包昨天在NuGet上更新4.0.2.206211351了v5.0.不幸的是,这导致了一些"标准" IdentityServer3代码的突破性变化.即从他们的代码示例中提取,所以我想很多开发人员可能会在未来几天看到这个问题.
使用v4.0.2.xxxxxx版本的软件包.我有
using System.IdentityModel.Tokens;
Run Code Online (Sandbox Code Playgroud)
在命名空间中.
然后在Configuration方法中开始如下:
public void Configuration(IAppBuilder app)
{
AntiForgeryConfig.UniqueClaimTypeIdentifier = "sub";
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{ ... };
Run Code Online (Sandbox Code Playgroud)
更新说明行后:
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
Run Code Online (Sandbox Code Playgroud)
造成问题.
第一件事就是Class显然已经进入了System.IdentityModel.Tokens.Jwt命名空间,这个解决方案并不是那么糟糕.
但是,我现在收到Object reference required for a non-static field错误JwtSecurityTokenHandler.InboundClaimTypeMap.
我是否在这里遗漏了一些东西,另一个需要的库或者在Startup.Configuration()被调用之前发生了什么需要深入研究?