
[英].net core self contained and config files, what if I need to change something in config file?
[英]Is this a bug in .NET 6 JwtSecurityToken or is there something I need to know?
鉴于此测试代码片段(正在进行中)
public virtual async Task<string> CreateTokenAsync(Token token)
{
JwtHeader header = await CreateHeaderAsync(token);
JwtPayload payload = await CreatePayloadAsync(token);
// bug payload appears to have the correct confirmation information but it's wrong in the Jwt
JwtSecurityToken xxx = new JwtSecurityToken(header, payload);
return await CreateJwtAsync(new JwtSecurityToken(header, payload));
}
有趣的一行是我创建一个 JwtSecurityToken 并将其分配给 xxx 以在调试期间进行检查。
有效载荷如下所示:
您会看到 cnf 包含一个字典,其中包含一个值为 foo 的条目。
但是,Jwt object 在其声明中有一个空条目,在其有效负载中有一个正确的值:
您可以看到 cnf 的声明值包含一个空字典,但有效负载具有正确的 foo 值。 这在 .NET 6 与 .NET 3.1 中有所不同。 在下游,我的 Jwt 看起来像这样,导致我的测试失败。 在 .NET Core 3.1 中,声明的值为 foo:
我不是这个主题的专家,所以也许这是我找不到的重大变化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.