我有一个标记绑定到标头中的每个请求 . 我希望能够检索该令牌并使用我所拥有的证书中的公钥对其进行验证 . 类似的东西是jwt simple,我'm not sure what the equivalent is for a ASP.NET Core project. There has to be something out there that connects the token to the public key to validate it, just not sure where to look. Thanks. I'也使用身份服务器4来生成我的令牌等 . 不确定这是否有帮助 .
我希望令牌认证的过程看起来像 -
请求来自客户端 - >从头部检索令牌 - >通过公钥验证令牌 - >如果有效请求数据库并检索数据 .
我该如何设置中间件?
我在startup.cs中有它,我基本上使用它作为模板 - > github bearer token example .
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidIssuer = Configuration["JWT:issuer"],
ValidAudience = Configuration["JWT:audience"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["JWT:key"]))
};
问题似乎是当我将我的公钥添加到appsettings.json页面时,它不想检索它并将其绑定到我收到的持有者令牌并获得错误
www-authenticate:Bearer error =“invalid_token”,error_description =“签名无效”
在我的回复 Headers 中 . 任何帮助表示感谢 .