System.IdentityModel.Tokens.Jwt的更新导致IdentityServer3 Client中的重大更改 [英] Update of System.IdentityModel.Tokens.Jwt causing breaking change in IdentityServer3 Client
问题描述
希望这是一个易于解决的问题.
Hopefully an easy one to resolve.
Microsoft的System.IdentityModels.Tokens.Jwt
包昨天在NuGet上从4.0.2.206211351
更新到了v5.0
.不幸的是,这会导致某些标准" IdentityServer3
代码发生重大变化.即从他们的代码示例中提取,因此我想未来几天会有很多开发人员会看到此问题.
Microsoft's System.IdentityModels.Tokens.Jwt
package was updated yesterday on NuGet from 4.0.2.206211351
to v5.0
. This is unfortunately causing a breaking change with some "standard" IdentityServer3
code. i.e. taken from their code samples so I imagine quite a few developers might see this issue over the coming days.
使用v4.0.2.xxxxxx版本的软件包.我有
using v4.0.2.xxxxxx version of the package. I have
using System.IdentityModel.Tokens;
在命名空间中.
然后在Configuration方法中开始于:
then in the Configuration method begins as:
public void Configuration(IAppBuilder app)
{
AntiForgeryConfig.UniqueClaimTypeIdentifier = "sub";
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{ ... };
更新后
更新配置行之后:
After Updating
After updating the confgiuration line:
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
正在引起问题.
首先,显然,该类已移入System.IdentityModel.Tokens.Jwt
命名空间,解决起来并不难.
The first thing being that the Class has, apparently, moved into the System.IdentityModel.Tokens.Jwt
namespace, this isn't so bad to resolve.
但是,我现在在JwtSecurityTokenHandler.InboundClaimTypeMap
上出现了Object reference required for a non-static field
错误.
However, I'm now getting an Object reference required for a non-static field
error on the JwtSecurityTokenHandler.InboundClaimTypeMap
.
我在这里丢失了某些东西吗?需要另一个库吗?或者在调用Startup.Configuration()
之前是否发生了需要挖掘的事情?
Am I missing something here, another library that's required or is there something happening before the Startup.Configuration()
is called that needs digging into?
推荐答案
当您去看医生并说我这样做总是很疼"时-医生会回答然后停止这样做";)
When you go to the doctor and say "it always hurts when I do this" - the doctor will reply "then stopping doing this" ;)
v4-> v5从定义上来说是一个重大变化.您需要v5吗?
v4 -> v5 is by definition a breaking change. Do you need v5?
话虽如此-一个简单的智能探索将使他们将InboundClaimTypeMap
重命名为DefaultInboundClaimTypeMap
.
That being said - a simple intellisense exploration would have brought up that they renamed InboundClaimTypeMap
to DefaultInboundClaimTypeMap
.
准备在此过程中进行更多重大更改.
Be prepared for more breaking changes along the way.
这篇关于System.IdentityModel.Tokens.Jwt的更新导致IdentityServer3 Client中的重大更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!